Comments (2)
Hi there,
This method is actually only available on iOS and from your screenshot, it looks like you are attempting to call it on Android. I recommend checking that you are on iOS before calling it (Platform.OS === "ios"
).
What you likely want to do is to subscribe to location updates with a large distance filter so your callback only gets called when a large distance change happens. You can do this cross-platform like this:
RNLocation.configure({
distanceFilter: 500, // Meters
desiredAccuracy: {
ios: "best",
android: "balancedPowerAccuracy"
}
})
// Subscribe
const unsubscribe = RNLocation.subscribeToLocationUpdates(locations => {
...
})
// Unsubscribe
unsubscribe();
I do think the error message for calling startMonitoringSignificantLocationChanges
on Android could be improved, so I'll leave this open as a reminder for me to do that.
Let me know if you have any other issues.
from react-native-location.
Hi @matt-oakes,
Thanks for the reply!
Got confused with subscribeToLocationUpdates
and subscribeToSignificantLocationUpdates
.
Very helpful library, btw!
from react-native-location.
Related Issues (20)
- location returning null sometimes on ios and android both. HOT 1
- subScribeLocationChanges() HOT 3
- 🔥 Method addObserver must be called on the main thread HOT 2
- Terrible accuracy - physial device Android 10, RN 0.6.4 HOT 3
- Is there any good and well-maintained alternative to this package? HOT 1
- Cant stop updates of RNLocation.subscribeToLocationUpdates HOT 2
- Not return heading HOT 2
- background configuration throwing error
- Failed to build android because of java classes HOT 9
- Wanings about some event emitters, about AddListener and removeListeners HOT 1
- subscribeToSignificantLocationUpdates doesn't work to me
- Undefined symbols for architecture arm64 HOT 1
- Requesting "always" permission when user has previously selected "whenInUse" causes request to hang (promise never resolves) (deprecate this library) HOT 2
- Failed to Build HOT 12
- Is this repo dead?
- RNLocation functions issue HOT 5
- nvert
- Error: package android.support.annotation does not exist HOT 2
- Not working when mobile in sleep mode[Android] HOT 1
- Error - Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'void
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-location.