SuperAPI AI Directory

geolocation

General & other

View repository

Updated 10-15 20:31

About this skill

Geolocation

Get a position (or snapshot) with explicit permission. Continuous streams: react-native-realtime-location. Background: react-native-background-location. Reverse address: reverse-geocoding.

Sources

Environment Typical API
Expo RN expo-location getCurrentPositionAsync
RN bare @react-native-community/geolocation or equivalent
Web navigator.geolocation

Non-negotiable rules

  • Request permission first; handle denied/restricted.
  • Timeout and maximumAge aware (don't freeze the UI forever).
  • Propagate accuracy; discard readings worse than the product threshold when critical.
  • Fallback UX if GPS off / no signal (manual input, last known, draggable map).
  • Don't block first paint unnecessarily — async + skeleton.

Flow

check services enabled
  → request permission
  → getCurrentPosition({ accuracy, timeout, maximumAge })
  → { lat, lng, accuracy, altitude?, heading?, speed?, timestamp }
  • iOS: When-In-Use is enough for a snapshot.
  • Android: fine vs coarse depending on usage; fine for pickup pin.

Typed errors

  • permission_denied
  • services_disabled
  • timeout
  • unavailable

Map to actionable copy (“Turn on location” / “Open Settings”).

Privacy

  • Minimize retention; don't send position without feature context.
  • Document usage in the policy when persisting to the backend.

Anti-patterns

  • Assuming success without checking permission
  • enableHighAccuracy: true always without need (battery)
  • Error swallow with 0,0 in the Gulf of Guinea
  • Requesting Always just for a one-off get

Completion criteria

  • Reliable snapshot with permission granted
  • All main errors with UX
  • Accuracy available to consumers (map/matching)
  • Works on iOS and Android (and web if in scope)