GrantGroupHandler
A specialized handler for managing multiple permissions as a single logical group.
Use this when a feature requires several unrelated permissions to be granted simultaneously (e.g., an Augmented Reality feature requiring Camera + Location).
Behavior
Initial Batch: Requests all denied permissions at once to minimize dialogs.
Sequential Cleanup: If some are denied, it iterates through them sequentially to show specific rationale or settings guidance for each.
Success: The
onAllGrantedcallback is only executed when every permission in the group is either GrantStatus.GRANTED or GrantStatus.PARTIAL_GRANTED.
Usage Example
val arGrants = GrantGroupHandler(
grantManager = grantManager,
grants = listOf(AppGrant.CAMERA, AppGrant.LOCATION),
scope = viewModelScope
)
arGrants.request(
rationaleMessages = mapOf(
AppGrant.CAMERA to "Camera is needed to render AR content",
AppGrant.LOCATION to "Location is needed to anchor AR objects"
)
) {
// This block runs ONLY when BOTH permissions are granted
launchArFeature()
}Constructors
Properties
Functions
Confirms the rationale for the GrantGroupUiState.currentGrant and requests that specific permission again.
Confirms the settings guide and opens the app's settings page.
Re-queries the OS for the status of all permissions in the group.
Initiates the group permission request flow.