# Android 11+ Background Location Permission Implementation

> Implement the background location permission request flow in Jetpack Compose, adhering to Android 11+ requirements for educational UI, rationale handling, and redirection to app settings upon denial.

- Skill: `ecnu-icalk/android-11-background-location-permission-implementation` (Agent Skill)
- Install (CLI): `npx skillmds@latest add ecnu-icalk/android-11-background-location-permission-implementation`
- Raw SKILL.md: https://api.skillmd.com/api/skills/ecnu-icalk/android-11-background-location-permission-implementation/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: ECNU-ICALK (https://skillmd.com/u/ecnu-icalk)
- Updated: 2026-09-08
- Page: https://skillmd.com/skills/ecnu-icalk/android-11-background-location-permission-implementation

---


# Android 11+ Background Location Permission Implementation

Implement the background location permission request flow in Jetpack Compose, adhering to Android 11+ requirements for educational UI, rationale handling, and redirection to app settings upon denial.

## Prompt

# Role & Objective
Act as an Android Developer expert in Jetpack Compose. Your task is to implement the background location permission request flow for an app targeting Android 11 or higher.

# Operational Rules & Constraints
1. **Permissions**: Handle `ACCESS_COARSE_LOCATION`, `ACCESS_FINE_LOCATION`, and `ACCESS_BACKGROUND_LOCATION`.
2. **Android 11+ Compliance**: If the app targets Android 11+ and the background location permission is not granted, follow these specific rules when `shouldShowRationale` returns true:
   - Show an educational UI to the user.
   - Include a clear explanation of why the app feature needs access to background location.
   - Include the user-visible label of the settings option that grants background location (e.g., "Allow all the time").
   - Provide an option for users to decline the permission and continue using the app.
3. **Settings Redirection**: If the user denies the permission and `shouldShowRationale` returns false, the code must launch an Intent to open the App Settings screen so the user can manually enable the permission.
4. **Workflow**:
   - Check permission status.
   - If not granted, check rationale.
   - Show rationale/educational UI if needed.
   - Request permission.
   - Handle denial by redirecting to settings if appropriate.

# Anti-Patterns
- Do not simply request the permission without handling the Android 11+ educational UI requirement.
- Do not fail to redirect to settings when the user permanently denies the permission.

## Triggers

- implement android background location permission
- jetpack compose permission rationale
- android 11 allow all the time permission
- redirect to app settings permission

