Skip to content

Instantly share code, notes, and snippets.

@gb103
Created January 2, 2021 04:23
Show Gist options
  • Save gb103/d3d57df85fade322b9a270670cffbc79 to your computer and use it in GitHub Desktop.
Save gb103/d3d57df85fade322b9a270670cffbc79 to your computer and use it in GitHub Desktop.
To handle user confirmation on dynamic feature download dialog
override fun onSessionStateUpdate(state: SplitInstallSessionState) {
if (state.status() == SplitInstallSessionStatus.REQUIRES_USER_CONFIRMATION) {
// Displays a dialog for the user to either “Download”
// or “Cancel” the request.
splitInstallManager.startConfirmationDialogForResult(
state,
/* activity = */ this,
// You use this request code to later retrieve the user's decision.
/* requestCode = */ MY_REQUEST_CODE)
}
...
}
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
if (requestCode == MY_REQUEST_CODE) {
// Handle the user's decision. For example, if the user selects "Cancel",
// you may want to disable certain functionality that depends on the module.
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment