Location command (nodes)
संक्षेप में
location.getएक node command है (node.invokeके माध्यम से)।- डिफ़ॉल्ट रूप से off।
- Settings एक selector का उपयोग करते हैं: Off / While Using / Always।
- अलग toggle: Precise Location।
Selector क्यों (केवल switch नहीं)
OS permissions multi-level हैं। हम in-app में एक selector expose कर सकते हैं, लेकिन OS अभी भी वास्तविक grant तय करता है।
- iOS/macOS: user system prompts/Settings में While Using या Always चुन सकता है।
- Android: background location एक अलग permission है; Android 10+ पर इसे अक्सर Settings flow की आवश्यकता होती है।
- Precise location एक अलग grant है (iOS 14+ "Precise", Android "fine" बनाम "coarse")।
UI में selector हमारे requested mode को चलाता है; वास्तविक grant OS settings में रहता है।
Settings model
प्रति node device:
location.enabledMode:off | whileUsing | alwayslocation.preciseEnabled: bool
UI व्यवहार:
whileUsingselect करने पर foreground permission request करता है।alwaysselect करने पर पहलेwhileUsingensure करता है, फिर background request करता है (या user को Settings में भेजता है यदि आवश्यक हो)।- यदि OS requested level deny करता है, तो highest granted level पर revert करें और status दिखाएं।
Command: location.get
node.invoke के माध्यम से called।
Params (suggested):
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: requested mode के लिए permission missing।LOCATION_BACKGROUND_UNAVAILABLE: app backgrounded है लेकिन केवल While Using allowed है।LOCATION_TIMEOUT: समय में कोई fix नहीं।LOCATION_UNAVAILABLE: system failure / कोई providers नहीं।