आज्ञा
Aagya¶
Permissions for Kotlin Multiplatform apps. Honest about platform differences, quiet by default, ready when you need more.
What you get¶
- Sealed permission model
- Stateless by default
- BYOS storage
- Crash-safe API
- Compose-native
- Apache 2.0
Aagya is a small KMP library that gives you a uniform permission API across Android and iOS without flattening their differences.
- The default flow uses
shouldShowRequestPermissionRationaleon Android andCLAuthorizationStatuson iOS as the source of truth. No storage required. - A
PermissionStatus.Denied(canAskAgain: Boolean)field tells your UI exactly when to show "Allow" vs "Open Settings". - Optional
PermissionPolicylets you layer stricter rules (for example "ask once, ever") with the storage adapter of your choice.
Quickstart¶
Add the dependency:
Use it:
@Composable
fun LocationPrompt() {
val controller = rememberPermissionController()
val scope = rememberCoroutineScope()
Button(onClick = {
scope.launch {
when (val r = controller.requestPermission(AppPermission.Location.Fine)) {
is PermissionResult.Granted -> startLocationFlow()
is PermissionResult.Denied -> if (!r.canAskAgain) controller.openAppSettings()
is PermissionResult.Cancelled,
is PermissionResult.PolicyExhausted -> Unit
}
}
}) { Text("Use my location") }
}
Continue with the Quickstart guide for setup details, or skip ahead to recipes for common patterns.
Why "Aagya"?¶
Aagya (आज्ञा) is the Sanskrit word for permission or consent. The library does what its name says.
It is the first of two small KMP libraries published under xyz.ksharma. The companion library, Dhruva, handles location.