---
id: "b9cd5018-3109-4dca-ac42-35b3ea82628c"
name: android-11-background-location-permission-flow-08d4fdb65527
description: "Implement the compliant background location permission request flow for Android 11+ using Jetpack Compose, adhering to official documentation requirements for educational UI and settings redirection."
version: "0.1.0"
tags:
  - "android"
  - "jetpack compose"
  - "permissions"
  - "background location"
  - "kotlin"
triggers:
  - "implement android 11 background location permission"
  - "ACCESS_BACKGROUND_LOCATION rationale"
  - "allow all the time location setting"
  - "jetpack compose permission settings redirect"
  - "android background location educational UI"
---

# Android 11+ Background Location Permission Flow

Implement the compliant background location permission request flow for Android 11+ using Jetpack Compose, adhering to official documentation requirements for educational UI and settings redirection.

## Prompt

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

# Operational Rules & Constraints
1. Use `rememberMultiplePermissionsState` to manage permissions including `ACCESS_BACKGROUND_LOCATION`.
2. Use `LaunchedEffect` to trigger permission requests.
3. **Educational UI Requirement:** If the app hasn't been granted the `ACCESS_BACKGROUND_LOCATION` permission and `shouldShowRationale()` returns true, show an educational UI that includes:
   - A clear explanation of why the app's feature needs access to background location.
   - The user-visible label of the settings option that grants background location (e.g., "Allow all the time").
   - An option for users to decline the permission, allowing them to continue using the app.
4. **Settings Redirection:** If the user denies the permission and `shouldShowRationale()` returns false, direct the user to the app settings to enable the permission manually.
5. Ensure the code handles the state changes correctly to launch the settings screen when appropriate.

# Anti-Patterns
- Do not simply request the permission without checking the rationale state first.
- Do not block the user from using the app if they decline the background location permission.

# Interaction Workflow
1. Initialize the permission state.
2. Check permission status.
3. Show rationale/educational UI if required.
4. Request permission.
5. Redirect to settings if permanently denied.

## Triggers

- implement android 11 background location permission
- ACCESS_BACKGROUND_LOCATION rationale
- allow all the time location setting
- jetpack compose permission settings redirect
- android background location educational UI


---
Source attribution: ECNU-ICALK
Original project: https://github.com/ECNU-ICALK/AutoSkill
License: MIT
License information: https://opensource.org/license/mit
Original upstream instructions; downloaded from Mega AI Hub.

## Upstream license notice

MIT License

Copyright (c) 2026 Gabriel Moreira

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.



# Mega AI Hub resource metadata

Creator / publisher: ECNU-ICALK
Original project: https://github.com/ECNU-ICALK/AutoSkill
Attribution basis: Upstream repository explicitly recorded in package mirror path

Fields of work: Development & Engineering
Roles: Frontend Developer, Mobile Developer
Specialties: Cross Platform, Frontend, Mobile
Tools: Jetpack Compose, Kotlin
Country applicability: Country not specified
Classification basis: Source catalog labels
Instruction SHA-256: d9c8072d2bbd8ca6b947d55d19f8c1eb6209983cade5a6f48823216a625afe49
