activate gps even when mobile is locked

activate gps even when mobile is locked

BY 21 Jan 2016 Web Application Development

Hi 

 

I have this code running well on a samsung z3: 

navigator.geolocation.getCurrentPosition(function(position) {
    		var lat, lon;
			lat = position.coords.latitude;
			lon = position.coords.longitude;
			updateCoordinateDisplay(lat, lon);
			map.setCenter(new google.maps.LatLng(lat, lon));
		}, function() {
			alert("Sorry, we're unable to detect your location");
		});

but as soon as the screen is locked the process stopped 

how can activate gps even when mobile is locked ?

 

Thanks 

Written by