Skip to content

Instantly share code, notes, and snippets.

@BurningDroid
Last active May 11, 2019 07:07
Show Gist options
  • Save BurningDroid/65e2d3e124a738d12baea86d7f13bf85 to your computer and use it in GitHub Desktop.
Save BurningDroid/65e2d3e124a738d12baea86d7f13bf85 to your computer and use it in GitHub Desktop.
Android: in-app updates
val appUpdateManager = AppUpdateManagerFactory.create(this)
appUpdateManager.appUpdateInfo.addOnCompleteListener {
val result = it.result
if (result.updateAvailability() == UpdateAvailability.UPDATE_AVAILABLE
&& result.isUpdateTypeAllowed(AppUpdateType.FLEXIBLE)) {
info("should show update")
appUpdateManager.startUpdateFlowForResult(
result,
AppUpdateType.FLEXIBLE,
this,
1)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment