My appcelerator app on iOS and Android requires getting the latest Geolocation every 5 seconds and sending the location back to a server.
It works well when the app is on and the screen is on, however on both platforms when the screen goes off the geolocation object doesn't appear to get updated very often - so even if I get the geolocation every 5 seconds it's not accurate.
How can I get the geolocation to regularly update when the phone screen is off?
You should request geolocation in foreground
Intent Servicein other case it will not work on Android O with 5 seconds accuracy.Also you should use
WakeLockto prevent sleep mode.