There are two modes
-
Flexible - This is default and the app User can use the app during update download, installation and restart needs to be triggered by user to be only used when adding a new feature
-
Immediate - In Immediate update install user will be blocked until the app is updated to the current version of available Play Store version
inAppUpdateManager = InAppUpdateManager(activity)
inAppUpdateManager.startUpdate(updateType)
There are some reasons when an update is mandatory. For this case you can implement a provider interface to decide if an update is a forced update
class DemoForceUpdateProvider : ForceUpdateProvider {
override fun requestUpdateShouldBeImmediate(availableVersionCode: Int, doUpdate: () -> Unit) {
// You can place a Database Trigger here for eg you can trigger from backend that the version with 2.0 need to get Forced Updated immediately.
// if a forced update is needed, just call doUpdate
doUpdate()
}