Last active
September 23, 2019 10:30
-
-
Save savvisingh/e32a241ee73f88f1b31691103aed6b92 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Creates instance of the manager. | |
val appUpdateManager = AppUpdateManagerFactory.create(context) | |
// Returns an intent object that you use to check for an update. | |
val appUpdateInfoTask = appUpdateManager.appUpdateInfo | |
// Checks that the platform will allow the specified type of update. | |
appUpdateInfoTask.addOnSuccessListener { appUpdateInfo -> | |
if (appUpdateInfo.updateAvailability() == UpdateAvailability.UPDATE_AVAILABLE | |
// For a immediate update, use AppUpdateType.IMMEDIATE | |
&& appUpdateInfo.isUpdateTypeAllowed(AppUpdateType.FLEXIBLE) | |
) { | |
// notify user that there is an available update | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment