-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Background location tracking #516
Comments
This might be an option or useful for inspiration for the 1st option: https://github.com/mauron85/react-native-background-geolocation |
I don't think 1 will be very hard on iOS - I'm sure I've seen react native APIs specifically for this but I'm not sure. I know this is a major buzzkill but I think we can start testing and warn people to leave the app open if they want tracking. |
I'm pretty sure it just works™ on iOS, we don't need to do anything except ensure our app is enabled for background updates (pretty sure it already is). https://developer.apple.com/library/archive/documentation/UserExperience/Conceptual/LocationAwarenessPG/CoreLocation/CoreLocation.html#//apple_ref/doc/uid/TP40009497-CH2-SW1 I'm sure there's more to it than that though so I will do some more reading. |
Ok we probably need to make sure this has been set to true as well. These docs suck, Apple. https://developer.apple.com/documentation/corelocation/cllocationmanager/1620568-allowsbackgroundlocationupdates |
we should probably set this too so people are aware that it is using your location/updating and it also provides an easy way for them to get back to it. During testing it will allow us to make sure we turn it off at the appropriate time (when reaching the geofence around HQ for example as well as a fallback timeout). https://developer.apple.com/documentation/corelocation/cllocationmanager/1620568-allowsbackgroundlocationupdates |
Looks like all but the status bar in my last comment is implemented on iOS: https://github.com/facebook/react-native/blob/master/Libraries/Geolocation/RCTLocationObserver.m#L215 |
its not only "leave it open" its leave it in the foreground and dont let the phone go to sleep. |
Hunch: iOS might already work if the app is left in the foreground but the phone is locked anyway. |
we could use that mauron85/react-native-background-geolocation package and just let it post locations directly to the server and the server do some magic to find which event responses to update |
Hunch: I dont use ios |
yeah longer term this is what I planned to do - we'll have a singleton location responder that activates whenever we're actively responding to an event so we're only ever submitting one location no matter how many things are running/happening etc. |
how far down the road might this happen. dont want to invest much time into something short time if you are realistically going to be coding this any time soon |
So we currently cant location track if the app is in the background.
Before I waste hours of my time working on this only to have my hopes and dreams squashed by @sdunster does anyone have a plan on how they want this to work.
Options:
custom native code
Pros: Would work very well
Cons: have to write and maintain custom native code for both ios and android
jamesisaac-react-native-background-task
Pros: react-native code library
Cons: fastest you can run code is every 15 minutes
transistorsoft/react-native-background-geolocation
Pros: react-native code library, external support
Cons: "android use requires a licence", $300 perpetual for 1 app. weirdly its MIT so not sure how they are working that licence fee when you could just fork it and remove the licence requirement.
...
The text was updated successfully, but these errors were encountered: