Last active
September 23, 2019 10:44
-
-
Save savvisingh/c505850838765cf0f4cd4ba7561ec1ad 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
// Create a listener to track downloading state updates. | |
val listener = InstallStateUpdatedListener { state -> | |
// Update progress indicator, request user to approve app reload | |
if (state.installStatus() == InstallStatus.DOWNLOADING) { | |
// show the progress to the User | |
updateStatetoDownloading() | |
}else if (state.installStatus() == InstallStatus.DOWNLOADED) { | |
// After the update is downloaded, show a notification | |
// and request user confirmation to restart the app. | |
popupSnackbarForCompleteUpdate() | |
} | |
} | |
// At some point before starting an update, register a listener for updates. | |
appUpdateManager.registerListener(listener) | |
// At some point when status updates are no longer needed,unregister the listener. | |
appUpdateManager.unregisterListener(listener) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment