Languages

Menu
Sites
Language
activate gps even when mobile is locked

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 

Responses

3 Replies
Kangsoo Lee

Hi, 

 

As I know, W3C gelocation apis can only get gps data when AP is awake. so you need to use another api for CPU not to go to sleep state.

https://developer.tizen.org/dev-guide/2.4/org.tizen.web.apireference/html/device_api/mobile/tizen/power.html#PowerResource

But If you use the power api to block sleep, This implementation causes more battery consumption. 

AVSukhov

Hello,

As Kangsoo Lee comment you can use Power API.

Or you can try to add background-support setting to your config.xml.

joachim Rodrigues

indeed added : 

<tizen:setting background-support="enable" />

and worked 

thanks