registerForPermissionFlowRequestsResult

fun ComponentActivity.registerForPermissionFlowRequestsResult(requestPermissionsContract: RequestPermissionsContract = RequestPermissionsContract(), activityResultRegistry: ActivityResultRegistry = getActivityResultRegistry(), callback: ActivityResultCallback<Map<String, Boolean>> = emptyCallback()): ActivityResultLauncher<Array<String>>

Returns a ActivityResultLauncher for this Activity which internally notifies PermissionFlow about the state change whenever permission state is changed with this launcher.

Usage:

class MyActivity: AppCompatActivity() {
private val permissionLauncher = registerForPermissionFlowRequestsResult()

fun askContactPermission() {
permissionLauncher.launch(android.Manifest.permission.READ_CONTACTS)
}
}

Parameters

requestPermissionsContract

A contract specifying permission request and result.

activityResultRegistry

Activity result registry. By default it uses Activity's Result registry.

callback

Callback of a permission state change.


fun Fragment.registerForPermissionFlowRequestsResult(requestPermissionsContract: RequestPermissionsContract = RequestPermissionsContract(), activityResultRegistry: ActivityResultRegistry = requireActivity().activityResultRegistry, callback: ActivityResultCallback<Map<String, Boolean>> = emptyCallback()): ActivityResultLauncher<Array<String>>

Returns a ActivityResultLauncher for this Fragment which internally notifies PermissionFlow about the state change whenever permission state is changed with this launcher.

Usage:

class MyFragment: Fragment() {
private val permissionLauncher = registerForPermissionFlowRequestsResult()

fun askContactPermission() {
permissionLauncher.launch(android.Manifest.permission.READ_CONTACTS)
}
}

Parameters

requestPermissionsContract

A contract specifying permission request and result.

activityResultRegistry

Activity result registry. By default it uses Activity's Result registry.

callback

Callback of a permission state change.