Created
January 2, 2021 04:23
-
-
Save gb103/d3d57df85fade322b9a270670cffbc79 to your computer and use it in GitHub Desktop.
To handle user confirmation on dynamic feature download dialog
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
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