rememberPermissionState

fun rememberPermissionState(permission: String, onPermissionResult: (Boolean) -> Unit = {}): PermissionState

Creates a PermissionState that is remembered across compositions.

It's recommended that apps exercise the permissions workflow as described in the documentation.

Parameters

permission

the permission to control and observe.

onPermissionResult

will be called with whether or not the user granted the permission after PermissionState.launchPermissionRequest is called.


fun rememberPermissionState(permission: String, onPermissionResult: (Boolean) -> Unit = {}, previewPermissionStatus: PermissionStatus = PermissionStatus.Granted): PermissionState

Creates a PermissionState that is remembered across compositions.

It's recommended that apps exercise the permissions workflow as described in the documentation.

Parameters

permission

the permission to control and observe.

onPermissionResult

will be called with whether or not the user granted the permission after PermissionState.launchPermissionRequest is called.

previewPermissionStatus

provides a PermissionStatus when running in a preview.