notifyPermissionsChanged

abstract fun notifyPermissionsChanged(vararg permissions: String)

This helps to check if specified permissions are changed and it verifies it and updates the state of permissions which are being observed via getMultiplePermissionState method.

This can be useful when you are not using result launcher which is provided with this library and manually handling permission request and want to update the state of permission in this library so that flows which are being observed should get an updated state.

If stopListening is called earlier and hasn't started listening again, notifying permission doesn't work. Its new state is automatically calculated after starting listening to states again by calling startListening method.

Example usage:

In this example, we are not using result launcher provided by this library. So we are manually notifying library about state change of a permission.

class MyActivity: AppCompatActivity() {
private val permissionFlow = PermissionFlow.getInstance()
private val permissionLauncher = registerForActivityResult(RequestPermission()) { isGranted ->
permissionFlow.notifyPermissionsChanged(android.Manifest.permission.READ_CONTACTS)
}
}

Parameters

permissions

List of permissions