Created
March 11, 2020 17:24
-
-
Save varundwarkani/86e6b4f1904459b7f7704fa73bdfd45d to your computer and use it in GitHub Desktop.
InAppUpdateStartInAppUpdate
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
//Boolean Compulsory is used to decide whether to start immediate update or flexible update. | |
private void startInAppUpdate(AppUpdateInfo appUpdateInfo, boolean compulsory) { | |
try { | |
if (compulsory) { | |
appUpdateManager.startUpdateFlowForResult( | |
appUpdateInfo, | |
IMMEDIATE, | |
this, | |
UPDATE_REQUEST_CODE); | |
} else { | |
appUpdateManager.startUpdateFlowForResult( | |
appUpdateInfo, | |
AppUpdateType.FLEXIBLE, | |
this, | |
Utils.showSnackbar(findViewById(android.R.id.content), "An update has been started. You will be notified when it is complete.", 2); | |
} | |
setInAppUpdateSuccessListener(compulsory); | |
} catch (IntentSender.SendIntentException e) { | |
e.printStackTrace(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment