A tiny Jetpack Compose UI library that provides two small components for improving Android permission UX:
- RationaleBanner — a lightweight animated banner for showing permission rationale
- DeniedGuideDialog — a Material 3 dialog for guiding users to system settings when a permission is permanently denied
Simple, UI-only, and no extra dependencies beyond Compose + Material3.
This library is not published online.
To use it:
- Copy the
permissions-uimodule into your project - Add the module dependency:
implementation(project(":permissions-ui"))A small popup banner displayed before requesting permission.
var showRationale by remember { mutableStateOf(false) }
RationaleBanner(
visible = showRationale,
title = "Camera Permission",
message = "Used to take photos."
)A dialog shown when a permission has been permanently denied.
All texts are fully customizable.
var showDeniedGuide by remember { mutableStateOf(false) }
DeniedGuideDialog(
visible = showDeniedGuide,
title = "Camera Permission Denied",
message = "Please enable camera permission in Settings.",
dismissText = "Cancel",
confirmText = "Open Settings",
onDismiss = { showDeniedGuide = false },
onConfirm = {
context.openAppSettings()
}
)
// Or use defaults:
DeniedGuideDialog(
visible = showDeniedGuide,
onDismiss = { showDeniedGuide = false },
onConfirm = {
context.openAppSettings()
}
)
Helper function:
fun Context.openAppSettings() {
val intent = Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS).apply {
data = "package:$packageName".toUri()
if (this@openAppSettings !is Activity) {
addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
}
}
startActivity(intent)
}-
Jetpack Compose
-
Material 3
Apache License 2.0