rememberPermissionState

Creates a PermissionState for a permission that is remembered across compositions.

Example:

@Composable
fun PermissionDemo() {
val state by rememberPermissionState(Manifest.permission.CAMERA)
if (state.isGranted) {
// Render something
} else {
if (state.isRationaleRequired) {
// Show rationale
}
// Render something else
}
}

Parameters

permission

The permission to observe.

Throws