
Lightweight runtime permission handler with simple callback API, multiple and sequential requests, permanent-denial detection, location/background permission support, and Compose-ready integration.
Simple and lightweight runtime permission handling library for Kotlin Multiplatform Mobile (KMM).
dependencies {
}| Permission | Android | iOS |
|---|---|---|
| Camera | ✅ | ✅ |
| Gallery | ✅ | ✅ |
| Microphone | ✅ | ✅ |
| PostNotifications | ✅ | ✅ |
| GeolocationOnAppUsing | ✅ | ✅ |
| GeolocationAlways | ✅ | ✅ |
| ReadContacts | ✅ | ✅ |
| WriteContacts | ✅ | ✅ |
| ReadExternalStorage | ✅ | ✅ |
| WriteExternalStorage | ✅ | ✅ |
Initialize PermissionHandler object on MainActivity or Application
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
PermissionHandler.start(this)
super.onCreate(savedInstanceState)
setContent {
App()
}
}
}Register your permission in manifest.xml
<uses-permission android:name="android.permission.CAMERA" />Register your permission in Info.plist
<key>NSCameraUsageDescription</key>
<string>We want to access the camera to take photos.</string>PermissionHandler.requestSingle(
Permission.Camera
) { granted ->
if (granted) {
// Permission granted your code for start camera, and take photo
} else {
// Permission denied
}
}PermissionHandler.requestMultiple(
Permission.Camera,
Permission.Microphone
) { grantedMap ->
val cameraGranted = grantedMap[Permission.Camera]
val microphoneGranted = grantedMap[Permission.Microphone]
}PermissionHandler.requestMultiplySequential(
Permission.GeolocationOnAppUsing,
Permission.GeolocationAlways
) { grantedMap -> // Requests background location sequentially after obtaining "While Using the App" permission
val backgroundGeolocation = grantedMap.all { (permission, granted) -> granted }
if (backgroundGeolocation) {
// Granted background geolocation start service
} else {
// Permission denied
}
}Simple and lightweight runtime permission handling library for Kotlin Multiplatform Mobile (KMM).
dependencies {
}| Permission | Android | iOS |
|---|---|---|
| Camera | ✅ | ✅ |
| Gallery | ✅ | ✅ |
| Microphone | ✅ | ✅ |
| PostNotifications | ✅ | ✅ |
| GeolocationOnAppUsing | ✅ | ✅ |
| GeolocationAlways | ✅ | ✅ |
| ReadContacts | ✅ | ✅ |
| WriteContacts | ✅ | ✅ |
| ReadExternalStorage | ✅ | ✅ |
| WriteExternalStorage | ✅ | ✅ |
Initialize PermissionHandler object on MainActivity or Application
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
PermissionHandler.start(this)
super.onCreate(savedInstanceState)
setContent {
App()
}
}
}Register your permission in manifest.xml
<uses-permission android:name="android.permission.CAMERA" />Register your permission in Info.plist
<key>NSCameraUsageDescription</key>
<string>We want to access the camera to take photos.</string>PermissionHandler.requestSingle(
Permission.Camera
) { granted ->
if (granted) {
// Permission granted your code for start camera, and take photo
} else {
// Permission denied
}
}PermissionHandler.requestMultiple(
Permission.Camera,
Permission.Microphone
) { grantedMap ->
val cameraGranted = grantedMap[Permission.Camera]
val microphoneGranted = grantedMap[Permission.Microphone]
}PermissionHandler.requestMultiplySequential(
Permission.GeolocationOnAppUsing,
Permission.GeolocationAlways
) { grantedMap -> // Requests background location sequentially after obtaining "While Using the App" permission
val backgroundGeolocation = grantedMap.all { (permission, granted) -> granted }
if (backgroundGeolocation) {
// Granted background geolocation start service
} else {
// Permission denied
}
}