With watch I mean using HTML5's native Geolocation watch support. This is meant for a web app, not a native one. Thanks for helping out :D
Background location access checklist Use the following checklist to identify potential location access logic in the background: In your app's manifest, check for the ACCESS_COARSE_LOCATION permission and the ACCESS_FINE_LOCATION permission. Verify that your app requires these location permissions.
Background location useIf you give an app permission to access your location while it's in use, the app can then ask to know where you are at all times.
Access to location is considered in the foreground if it happens while the app is open and visible to the user. If the user closes the app, or hits the home button to return to their main screen, then the app's access to location is considered in the background.
In order to enable background location access, users must set the Allow all the time option for your app's location permission on a settings page, as described in the guide on how to Request background location.
You cannot watch the user's location from a Web App in background. I have checked it on Chrome (Android M), and as soon as the Web App goes to background the GPS icon disappears and the watch position process is stopped. (Once the Web App is in the foreground again, the watch process is resumed).
The same is happening when the device is locked. The watch process is stopped until the user unlocks it and the Web App is in the foreground.
UPDATE 2021-04
There is a new API in discussion, "Geotracking", that will allow for background tracking. The issue needs votes, though. If you are interested in doing so, go here: https://bugs.chromium.org/p/chromium/issues/detail?id=898536
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With