getIntent
fun getIntent(context: Context, appPackageName: String, @DrawableRes image: Int, topMessage: String, bottomMessage: String): Intent
Returns the Intent to display an install tile prompt to the user.
This can be used in Compose with rememberLauncherForActivityResult and ActivityResultLauncher.launch:
val launcher = rememberLauncherForActivityResult(
ActivityResultContracts.StartActivityForResult()
) { result ->
if (result.resultCode == RESULT_OK) {
// user pushed add Tile!
}
}
launcher.launch(installTilePrompt.getIntent(/*params*/))
Content copied to clipboard
It can also be used directly in an ComponentActivity with ComponentActivity.registerForActivityResult:
val launcher = registerForActivityResult(
ActivityResultContracts.StartActivityForResult()
) { result ->
if (result.resultCode == RESULT_OK) {
// user pushed add tile!
}
}
launcher.launch(installTilePrompt.getIntent(/*params*/))
Content copied to clipboard