permissions
Skill15 starsChanged 9 months agoMITView on GitHub
Android runtime permissions for AI agents. Use this skill whenever requesting permissions, handling permission results, camera permission, location permission, microphone permission, storage permission, contacts permission, notifications permission, Bluetooth permission, ActivityResultLauncher, requestPermissions, shouldShowRequestPermissionRationale, Accompanist Permissions, rememberPermissionState, rememberMultiplePermissionsState, permission denied handling, permission rationale dialog, or any runtime permission flow.
4 other projects use a version of this.
Adopted by
Most recently taken up by
- oprogramadorreal/optimus-claudetheir own version, first seen Sep 4, 2026
- aborroy/aiup-alfrescotheir own version, first seen Jun 22, 2026
- pantalytics/odoo-mcp-protheir own version, first seen Jun 11, 2026
- Veeiy/vantage-ostheir own version, first seen Jun 6, 2026
Other versions4 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 4
- pantalytics/odoo-mcp-pro★ 84same name
- oprogramadorreal/optimus-claude★ 75same name
- aborroy/aiup-alfresco★ 14same name
- Veeiy/vantage-os★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository27 other files it gives its agents.
- AGENTS.mdAGENTS.md
- accessibilitySkill
- adaptive-uiSkill
- android-architectureSkill
- android-setupSkill
- android-testingSkill
- biometricsSkill
- ci-cd-androidSkill
- compose-animationSkill
- compose-navigationSkill
- compose-uiSkill
- datastoreSkill
- design-systemSkill
- design-tokensSkill
- firebaseSkill
- gradleSkill
- hilt-diSkill
- kotlin-patternsSkill
- material3Skill
- notificationsSkill
- offline-firstSkill
- performanceSkill
- play-store-releaseSkill
- retrofitSkill
- room-databaseSkill
- securitySkill
- supabase-androidSkill
The file
Files
Android Runtime Permissions
Rule 1: Always use Accompanist Permissions in Compose
implementation(libs.accompanist.permissions)// ✅ Single permission
@OptIn(ExperimentalPermissionsApi::class)
@Composable
fun CameraScreen() {
val cameraPermission = rememberPermissionState(Manifest.permission.CAMERA)
when {
cameraPermission.status.isGranted -> {
CameraPreview()
}
cameraPermission.status.shouldShowRationale -> {
PermissionRationale(
title = "Camera required",
description = "This feature requires camera access to scan items.",
onRequest = { cameraPermission.launchPermissionRequest() }
)
}
else -> {
// First time or permanently denied
LaunchedEffect(Unit) { cameraPermission.launchPermissionRequest() }
}
}
}
// ✅ Multiple permissions
@OptIn(ExperimentalPermissionsApi::class)
@Composable
fun LocationScreen() {
val locationPermissions = rememberMultiplePermissionsState(
listOf(
Manifest.permission.ACCESS_FINE_LOCATION,
Manifest.permission.ACCESS_COARSE_LOCATION
)
)
when {
locationPermissions.allPermissionsGranted -> LocationContent()
locationPermissions.shouldShowRationale -> PermissionRationale(
title = "Location required",
description = "We need your location to show nearby items.",
onRequest = { locationPermissions.launchMultiplePermissionRequest() }
)
else -> LaunchedEffect(Unit) { locationPermissions.launchMultiplePermissionRequest() }
}
}Rule 2: Rationale dialog — always explain before requesting
// ✅ Standard permission rationale composable
@Composable
fun PermissionRationale(
title: String,
description: String,
onRequest: () -> Unit,
onDismiss: () -> Unit = {},
onOpenSettings: (() -> Unit)? = null
) {
AlertDialog(
onDismissRequest = onDismiss,
icon = { Icon(Icons.Default.Info, contentDescription = null) },
title = { Text(title) },
text = { Text(description) },
confirmButton = {
TextButton(onClick = onRequest) { Text("Grant permission") }
},
dismissButton = {
if (onOpenSettings != null) {
TextButton(onClick = onOpenSettings) { Text("Open settings") }
} else {
TextButton(onClick = onDismiss) { Text("Not now") }
}
}
)
}
// ✅ Open app settings when permanently denied
fun Context.openAppSettings() {
startActivity(Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS).apply {
data = Uri.fromParts("package", packageName, null)
})
}Rule 3: Declare permissions in AndroidManifest
<!-- Required in AndroidManifest.xml before requesting -->
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<!-- Storage — Android 13+ uses granular permissions -->
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />
<!-- Android 12 and below -->
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"
android:maxSdkVersion="32" />
<!-- Notifications — required for Android 13+ -->
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<!-- Bluetooth — Android 12+ split permissions -->
<uses-permission android:name="android.permission.BLUETOOTH_SCAN"
android:usesPermissionFlags="neverForLocation" />
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />Rule 4: Background location — separate request flow
// ✅ Request foreground location first, then background separately
@OptIn(ExperimentalPermissionsApi::class)
@Composable
fun BackgroundLocationScreen() {
val foregroundLocation = rememberMultiplePermissionsState(
listOf(Manifest.permission.ACCESS_FINE_LOCATION)
)
val backgroundLocation = rememberPermissionState(
Manifest.permission.ACCESS_BACKGROUND_LOCATION
)
when {
!foregroundLocation.allPermissionsGranted -> {
// Step 1: request foreground first
RequestForegroundLocation(onRequest = { foregroundLocation.launchMultiplePermissionRequest() })
}
!backgroundLocation.status.isGranted -> {
// Step 2: only after foreground granted
RequestBackgroundLocation(onRequest = { backgroundLocation.launchPermissionRequest() })
}
else -> BackgroundLocationContent()
}
}Common Mistakes
❌ Requesting permission without rationale — users deny without explanation ❌ Requesting multiple unrelated permissions at once — request only when needed ❌ Not handling permanently denied state — always offer "Open Settings" option ❌ Requesting background location before foreground — Android rejects this ❌ Missing permission in AndroidManifest — request will always be denied ❌ Requesting WRITE_EXTERNAL_STORAGE on Android 10+ — not needed, use scoped storage
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

