Augmented Permissions is a higher-level permission API for Jetpack Compose, built on Accompanist Permissions.
Its primary motivation is closing a gap in both Android's stock permission API and Accompanist Permissions: neither provides an unambiguous way to react when launching a permission request is suppressed and no system dialog appears.
Augmented Permissions addresses this by combining Android's rationale state with persisted request history. This allows a PermissionState to distinguish an initial request from one that has already been made and is now considered suppressed.
Applications remain responsible for persisting the request history for each permission requirement through PermissionRequestHistory, keeping the library independent of any particular storage solution.
val permissionState = rememberPermissionState(
permission = Manifest.permission.CAMERA,
requestHistory = cameraPermissionHistory,
onRequestSuppressed = { openAppSettings() }
)
permissionState.launchRequest()Beyond suppression handling, Augmented Permissions provides a few additional conveniences:
- a unified
PermissionStatefor single and multiple permissions - a consistent
isGranted,shouldShowRationale, andrevokedPermissionsAPI isLaunchingSuppressedfor inspecting suppression state directlygrantedFromRequestas aSharedFlow, allowing multiple consumers to independently react to permission-request results- no Accompanist types in the public API
dependencies {
implementation("io.github.w2sv:augmented-permissions:<version>")
}[versions]
w2sv-augmented-permissions = "<version>"
[libraries]
w2sv-augmented-permissions = { module = "io.github.w2sv:augmented-permissions", version.ref = "w2sv-augmented-permissions" }Then add the alias:
dependencies {
implementation(libs.w2sv.augmented.permissions)
}Licensed under the Apache License 2.0.