fix(android): remove background location mode

This commit is contained in:
Ayaan Zaidi
2026-03-08 14:48:24 +05:30
committed by Ayaan Zaidi
parent 0f9566b0b5
commit 1230cefe25
9 changed files with 22 additions and 105 deletions

View File

@@ -1,8 +1,8 @@
---
summary: "Location command for nodes (location.get), permission modes, and background behavior"
summary: "Location command for nodes (location.get), permission modes, and Android foreground behavior"
read_when:
- Adding location node support or permissions UI
- Designing background location + push flows
- Designing Android location permissions or foreground behavior
title: "Location Command"
---
@@ -12,15 +12,15 @@ title: "Location Command"
- `location.get` is a node command (via `node.invoke`).
- Off by default.
- Settings use a selector: Off / While Using / Always.
- Android app settings use a selector: Off / While Using.
- Separate toggle: Precise Location.
## Why a selector (not just a switch)
OS permissions are multi-level. We can expose a selector in-app, but the OS still decides the actual grant.
- iOS/macOS: user can choose **While Using** or **Always** in system prompts/Settings. App can request upgrade, but OS may require Settings.
- Android: background location is a separate permission; on Android 10+ it often requires a Settings flow.
- iOS/macOS may expose **While Using** or **Always** in system prompts/Settings.
- Android app currently supports foreground location only.
- Precise location is a separate grant (iOS 14+ “Precise”, Android “fine” vs “coarse”).
Selector in UI drives our requested mode; actual grant lives in OS settings.
@@ -29,13 +29,12 @@ Selector in UI drives our requested mode; actual grant lives in OS settings.
Per node device:
- `location.enabledMode`: `off | whileUsing | always`
- `location.enabledMode`: `off | whileUsing`
- `location.preciseEnabled`: bool
UI behavior:
- Selecting `whileUsing` requests foreground permission.
- Selecting `always` first ensures `whileUsing`, then requests background (or sends user to Settings if required).
- If OS denies requested level, revert to the highest granted level and show status.
## Permissions mapping (node.permissions)
@@ -80,24 +79,11 @@ Errors (stable codes):
- `LOCATION_TIMEOUT`: no fix in time.
- `LOCATION_UNAVAILABLE`: system failure / no providers.
## Background behavior (future)
## Background behavior
Goal: model can request location even when node is backgrounded, but only when:
- User selected **Always**.
- OS grants background location.
- App is allowed to run in background for location (iOS background mode / Android foreground service or special allowance).
Push-triggered flow (future):
1. Gateway sends a push to the node (silent push or FCM data).
2. Node wakes briefly and requests location from the device.
3. Node forwards payload to Gateway.
Notes:
- iOS: Always permission + background location mode required. Silent push may be throttled; expect intermittent failures.
- Android: background location may require a foreground service; otherwise, expect denial.
- Android app denies `location.get` while backgrounded.
- Keep OpenClaw open when requesting location on Android.
- Other node platforms may differ.
## Model/tooling integration
@@ -109,5 +95,4 @@ Notes:
- Off: “Location sharing is disabled.”
- While Using: “Only when OpenClaw is open.”
- Always: “Allow background location. Requires system permission.”
- Precise: “Use precise GPS location. Toggle off to share approximate location.”