rememberPermissionFlowRequestLauncher
fun rememberPermissionFlowRequestLauncher(onResult: (Map<String, Boolean>) -> Unit = {}): ManagedActivityResultLauncher<Array<String>, Map<String, Boolean>>
Creates a ManagedActivityResultLauncher that is tied with PermissionFlow APIs and remembered across recompositions.
Example:
@Composable
fun DemoPermissionLaunch() {
val permissionLauncher = rememberPermissionFlowRequestLauncher()
Button(onClick = { permissionLauncher.launch(Manifest.permission.CAMERA) }) {
Text("Launch Camera Permission Request")
}
}
Content copied to clipboard
Make sure to use ManagedActivityResultLauncher.launch method inside callback or a side effect and not directly in the compose scope. Otherwise, it'll be invoked across recompositions.
Parameters
onResult
The callback to invoke when the result is received.