This behaviour causes the app to be pretty battery intensive unless you kill it.
When using AppState to listen for background events to manually set to false it still does not turn off the GPS? I can confirm the false prop is being passed and the render function is being called.
Setting to always false sets the GPS to off as expected.
This is on commit #6f5add776450a188e17a686555e102c949dcd39d as of Dec 13th.
I attempted to bypass this by using a MapboxGL.CircleLayer and the navigator.geolocation.watchPosition to manually draw my location.
It works, no more constant GPS active, however, when entering navigation mode in my app I set userTrackingMode={MapboxGL.UserTrackingModes.FollowWithHeading}.
After ending navigation I set userTrackingMode={MapboxGL.UserTrackingModes.None}, but the GPS never turns off.
Im seeing this same issue again on my app. This was already fixed in #705 but is again broken.
Do you have any ideas for this @nitaliano ?
it could be the telem service https://github.com/mapbox/react-native-mapbox-gl/issues/878#issuecomment-355913423 I haven't looked into it yet though but I will check it out
Any progress on this? It's a pretty big roadblock to using this in production.
I'll debug this one with current master today, now that the location fixes are in
I'm not seeing this issue on master
Thanks @nitaliano - I'll check it out tomorrow!
The latest master version always has my GPS active @nitaliano? Even with showUserLocation={false} and userTrackingMode={MapboxGL.UserTrackingModes.None} both set?
This is while running #925899c0ee1fd5ce21a5ea14fda4551b2bb7d8e1 on a Galaxy S7 with Android 7
I'm not seeing location updates come through our callbacks when I turn it off. Are you sure it's not the telemetry service https://github.com/mapbox/react-native-mapbox-gl/issues/878#issuecomment-354802730? How are you checking that the GPS is active so I can follow those same steps?
We are using 6.0.3-rc1 and GPS is indeed on even our app is on background. Only when I kill the app then GPS turns off.
Huawei ALE-L21
Android 6.0
Hey,
in an effort to clean out old tickets, I'm closing this one. Please check the issue again with the latest master branch and reopen if the issue still persists.
Most helpful comment
I attempted to bypass this by using a
MapboxGL.CircleLayerand thenavigator.geolocation.watchPositionto manually draw my location.It works, no more constant GPS active, however, when entering navigation mode in my app I set
userTrackingMode={MapboxGL.UserTrackingModes.FollowWithHeading}.After ending navigation I set
userTrackingMode={MapboxGL.UserTrackingModes.None}, but the GPS never turns off.