I have a vision to develop a web-based application that will consistently track users' GPS locations by utilizing HTML5's geolocation
feature. The majority of the users being monitored will be accessing the app through mobile devices.
I am aware that I can retrieve users' location data with the following code snippet:
<script>
navigator.geolocation.getCurrentPosition(function(location) {
console.log(location.coords.latitude);
console.log(location.coords.longitude);
console.log(location.coords.accuracy);
});
</script>
However, my current challenge is how to make this JavaScript code run continuously. I want the code to continue functioning even when the device screen is locked or in "wait" mode.
Some questions on my mind are:
- Is it feasible to achieve this using browser-based technology?
- Could I potentially be using the wrong approach? Should I consider developing native mobile applications instead?