OpenClawSkills
GitHub
Nodes & Media • TutorialHeader.readTime

Location Command

Node location command (location.get), permission modes, background behavior

Tutorial.step

Summary

- location.get is a node command (via node.invoke).

- Default is off.

- Config uses a selector: off / while using / always.

- Independent toggle: precise location.

Tutorial.step

Why a Selector (Not Just a Switch)

OS permissions are multi-level. We can expose a selector in-app, but the OS decides actual grants.

- iOS/macOS: User can choose While Using or Always in system prompt/settings. App can request upgrade, OS might require settings.

- Android: Background location is a separate permission; Android 10+ often requires settings flow.

- Precise location is a separate grant (iOS 14+ "precise", Android "fine" vs "coarse").

Selector in UI drives requested mode; actual grant is in OS settings.

Tutorial.step

Config Model

Per node device:

- location.enabledMode: off | whileUsing | always

- location.preciseEnabled: boolean

UI Behavior:

- Selecting whileUsing requests foreground permission.

- Selecting always ensures whileUsing first, then requests background (sending user to settings if needed).

- If OS denies requested level, reverts to highest granted level and shows status.

Tutorial.step

Permission Mapping (node.permissions)

Optional. macOS nodes report location via permission map; iOS/Android might omit.

Tutorial.step

Command: `location.get`

Called via node.invoke.

Parameters (recommended):

Json
{
  "timeoutMs": 10000,
  "maxAgeMs": 15000,
  "desiredAccuracy": "coarse|balanced|precise"
}

Response Payload:

Json
{
  "lat": 48.20849,
  "lon": 16.37208,
  "accuracyMeters": 12.5,
  "altitudeMeters": 182.0,
  "speedMps": 0.0,
  "headingDeg": 270.0,
  "timestamp": "2026-01-03T12:34:56.000Z",
  "isPrecise": true,
  "source": "gps|wifi|cell|unknown"
}

Errors (stable codes):

- LOCATION_DISABLED: Selector off.

- LOCATION_PERMISSION_REQUIRED: Missing permission for requested mode.

- LOCATION_BACKGROUND_UNAVAILABLE: App in background but only allowed while using.

- LOCATION_TIMEOUT: No fix in time.

- LOCATION_UNAVAILABLE: System failure / no provider.

Tutorial.step

Background Behavior (Future)

Goal: Model can request location even if node is in background, but only if:

- User selected Always.

- OS granted background location.

- App is allowed to run in background (iOS Background Mode / Android Foreground Service or special permission).

Push Trigger Flow (Future):

1. Gateway sends push to node (Silent Push or FCM Data).

2. Node wakes temporarily and requests location from device.

3. Node forwards payload back to Gateway.

Note:

- iOS: Requires Always permission + Background Location mode. Silent pushes may be throttled; expect intermittent failures.

- Android: Background location might require Foreground Service; otherwise expect denial.

Tutorial.step

Model/Tool Integration

- Tool Surface: nodes tool adds location_get action (requires node).

- CLI: openclaw nodes location get --node <id>.

- Agent Guidelines: Call only if user enabled location and understands scope.

Tutorial.step

UX Copy (Recommended)

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