1---2name: android-permissions-activity-results3description: Use modern permission requests, Activity Result APIs, and capability-gated UX in Android flows.4---5# Android Permissions Activity Results67## When To Use8- Use this skill when the request is about: android permission request flow, activity result api android, camera permission in android app.9- Primary outcome: Use modern permission requests, Activity Result APIs, and capability-gated UX in Android flows.10- Read `references/patterns.md` when you need the picker-vs-permission matrix or API-level behavior checklist.11- Read `references/scenarios.md` for photo picker, notification permission, and limited media access examples.12- Handoff skills when the scope expands:13- `android-media-files-sharing`14- `android-testing-ui`1516## Workflow171. Start with the capability the user needs, not the permission name: photo picker, document picker, camera capture, or notification opt-in often avoids broader runtime permissions.182. Choose the right Activity Result contract and keep the launcher in a stable lifecycle owner such as an activity, fragment, or remembered Compose launcher.193. Model the full permission state space explicitly: granted, denied, permanently denied, limited/selected access, one-time access, and settings-based recovery.204. Account for API-level differences such as `POST_NOTIFICATIONS` on Android 13+, approximate vs precise location, background location as a separate flow, and Android 14 selected-photos access.215. Re-check capability on return from settings or picker flows, then validate rotation, process death, and denial recovery instead of assuming the happy path.2223## Guardrails24- Treat loading, empty, error, offline, and permission-denied states as first-class UI states.25- Do not launch permission or picker contracts directly from composition without a user action or explicit side effect.26- Prefer the narrowest capability surface available, such as Photo Picker or SAF, over broad storage permissions.27- Keep permission recovery testable: rationale, settings redirect, denied state, and post-return revalidation.2829## Anti-Patterns30- Assuming the happy path is enough for product flows.31- Repeatedly re-prompting after denial instead of offering a clear settings or alternate-path recovery.32- Requesting media or storage access when the Photo Picker or document contracts are enough.33- Treating Android 14 selected-photos access as full media-library access.3435## Review Focus36- Can the feature use a picker or contract instead of a runtime permission?37- Does the flow handle denial, limited access, and return-from-settings correctly?38- Are permission launches owned by the right lifecycle scope and initiated at the right time?39- Are platform-specific behaviors called out for Android 13+ and Android 14+ where relevant?4041## Examples42### Happy path43- Scenario: Find the repo's Activity Result and permission surfaces before proposing a flow change.44- Command: `rg -n "rememberLauncherForActivityResult|RequestPermission|RequestMultiplePermissions|PickVisualMedia|OpenDocument|TakePicture" examples`4546### Edge case47- Scenario: Review notification and media access paths for API-level-specific behavior.48- Command: `rg -n "POST_NOTIFICATIONS|READ_MEDIA_|READ_EXTERNAL_STORAGE|PickVisualMedia" examples`4950### Failure recovery51- Scenario: Differentiate permission prompts from media-sharing and testing requests.52- Command: `python3 scripts/eval_triggers.py --skill android-permissions-activity-results`5354## Done Checklist55- The chosen contract or picker is narrower than a broad permission where possible.56- Denied, permanently denied, limited, and settings-return states are all modeled.57- API-level differences are called out for the affected Android versions.58- Recovery UI and observability are explicit instead of implied.5960## Official References61- [https://developer.android.com/training/permissions/requesting](https://developer.android.com/training/permissions/requesting)62- [https://developer.android.com/training/basics/intents/result](https://developer.android.com/training/basics/intents/result)63- [https://developer.android.com/training/data-storage/shared/photopicker](https://developer.android.com/training/data-storage/shared/photopicker)64- [https://developer.android.com/about/versions/14/changes/partial-photo-video-access](https://developer.android.com/about/versions/14/changes/partial-photo-video-access)65- [https://developer.android.com/develop/ui/views/notifications/notification-permission](https://developer.android.com/develop/ui/views/notifications/notification-permission)66- [https://developer.android.com/privacy-and-security/minimize-permission-requests](https://developer.android.com/privacy-and-security/minimize-permission-requests)