AutoSkill 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.

install
source · Clone the upstream repo
git clone https://github.com/ECNU-ICALK/AutoSkill
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/ECNU-ICALK/AutoSkill "$T" && mkdir -p ~/.claude/skills && cp -r "$T/SkillBank/ConvSkill/english_gpt3.5_8_GLM4.7/android-11-background-location-permission-implementation" ~/.claude/skills/ecnu-icalk-autoskill-android-11-background-location-permission-implementation && rm -rf "$T"
manifest: SkillBank/ConvSkill/english_gpt3.5_8_GLM4.7/android-11-background-location-permission-implementation/SKILL.md
source content

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