Geolocation
You need to include the NSLocationWhenInUseUsageDescription
key in Info.plist to enable geolocation. Geolocation is enabled by default when you create a project with react-native init
.
Geolocation follows the MDN specification: https://developer.mozilla.org/en-US/docs/Web/API/Geolocation
Methods
Reference
Methods
getCurrentPosition()
static getCurrentPosition(geo_success, geo_error?, geo_options?)
Invokes the success callback once with the latest location info. Supported options: timeout (ms), maximumAge (ms), enableHighAccuracy (bool)
watchPosition()
static watchPosition(success, error?, options?)
Invokes the success callback whenever the location changes. Supported options: timeout (ms), maximumAge (ms), enableHighAccuracy (bool)
clearWatch()
static clearWatch(watchID)
stopObserving()
static stopObserving()