v2.1.0
New Features
RNLocation.getLatestLocation
Get the latest location. Ensure you have the correct permission before calling this method.
This will subscribe to location events for you at the unsubscribe when it gets its first valid location. Usually, this method will return very fast with a possibly out of date location, however, in some circumstances, it will not return a location. Therefore, this method has a timeout after which the promise will be resolved with null
value.
The location provider will respect the settings you have given it, so if you need a location with a certain accuracy, ensure you call RNLocation.configure
first. If you want any location then ensure you call RNLocation.configure
with no distance filter.
RNLocation.configure({ distanceFilter: null });
RNLocation.getLatestLocation({ timeout: 60000 })
.then(latestLocation => {
// Use the location here
})