RequestNotificationPermission

fun RequestNotificationPermission(onChanged: (Boolean) -> Unit = {}, content: @Composable (Boolean) -> Unit)

A wrapper for composables that show notifications to the user.

This composable will request the notification permission if needed.

Content is displayed in any case and the state of the permission is given as a parameter.

Example:

RequestNotificationPermission(
onChanged = { granted ->
// Handle notification state change
}
) { canShowNotifications ->
// Your content
}

Parameters

onChanged

A callback that will be called when the state of the notification changes.

content

The content to display. The parameter is true if the notification permission is granted or not required, false otherwise.