I've implemented in-app update in my Android Application with FLEXIBLE update flow. I'm checking and requesting for the update in onCreate() of MainActivity
While updating the app, always install failed with error code -100
which is mentioned at ERROR_INTERNAL_ERROR . Can anyone help me to solve this
val appUpdateManager = AppUpdateManagerFactory.create(this)
appUpdateManager.registerListener { state ->
if (state.installStatus() == InstallStatus.FAILED) {
Log.e("::MG::", "appUpdateManager:Status.FAILED")
Log.e("::MG::", "appUpdateManager:ErrorCode:"+state.installErrorCode())
}
if (state.installStatus() == InstallStatus.DOWNLOADED) {
//sBR(mainhell, resources.getString(R.string.exit))
val snackbar = Snackbar.make(
mainhell,
"Update has been downloaded. \nDo you want to install?",
Snackbar.LENGTH_INDEFINITE
)
.setAction("INSTALL") {
//If Downloaded Install Update
val i = Intent(applicationContext, MainActivity::class.java)
finish()
startActivity(i)
appUpdateManager.completeUpdate()
}
snackbar.setActionTextColor(Color.YELLOW)
snackbar.show()
}
}
val appUpdateInfoTask = appUpdateManager.appUpdateInfo
appUpdateInfoTask.addOnSuccessListener { appUpdateInfo ->
when {
appUpdateInfo.updateAvailability() == UpdateAvailability.UPDATE_AVAILABLE &&
appUpdateInfo.isUpdateTypeAllowed(AppUpdateType.FLEXIBLE)
-> {
appUpdateManager.startUpdateFlowForResult(
appUpdateInfo,
AppUpdateType.FLEXIBLE,
this,
FLEXIBLE_UPDATE
)
}
appUpdateInfo.installStatus() == InstallStatus.DOWNLOADED -> {
if (appUpdateManager != null) {
appUpdateManager.completeUpdate()
}
}
}
}
Logcate
E/::MG::: appUpdateManager:InstallStatus.FAILED E/::MG::: appUpdateManager:installErrorCode:-100