I'm using the in app update api for getting new update for my app but I'm still getting the update App dialog after update the App from Play store while testing the release signed apk . Please help me why I'm getting the update app option when it's already updated app.
Asked
Active
Viewed 366 times
0
-
Implemented in app update and the play store app doesn't have in app code, so i am testing the app by having lower signed apk version code. while testing , it display the update dialog .After updating the app and opening the app again it still showing update dialog..anyone help me to resolve this issue. – Nirmala Oct 19 '22 at 16:21
1 Answers
0
You should have an implementation in order to manage the listener and unregister it when status is installed.
Similar to this
private lateinit var appUpdateManager: AppUpdateManager
private lateinit var updateListener: InstallStateUpdatedListener
private fun setUpdateAction(context: Activity) {
updateListener = InstallStateUpdatedListener {
when (it.installStatus()) {
InstallStatus.FAILED,
InstallStatus.UNKNOWN,
InstallStatus.CANCELED -> {
unregisterListener(updateListener)
setErrorUpdateListener()
}
InstallStatus.DOWNLOADED -> {
updateDownloaded()
}
InstallStatus.INSTALLED -> {
unregisterListener(updateListener)
}
InstallStatus.DOWNLOADING,
InstallStatus.INSTALLING,
InstallStatus.PENDING -> {
//Other App update states
}
else -> {
//Undefined error
unregisterListener(updateListener)
setErrorUpdateListener()
}
}
}
appUpdateManager.registerListener(updateListener)
startInAppUpdate(context, AppUpdateType.FLEXIBLE)
}
private fun unregisterListener(listener: InstallStateUpdatedListener) {
appUpdateManager.unregisterListener(listener)
}

Adriana Mendez
- 11
- 2