Get current location in web application

To get information about your current location you can use getCurrentPosition() method from Geolocation API. Also don't forget to add "location" privilage and "location.gps" feature to config.xml.
// code (config.xml):
<tizen:privilege name="http://tizen.org/privilege/location"/>
<feature name="http://tizen.org/feature/location.gps"/>
// code (main.js):
var options = {enableHighAccuracy: true, maximumAge: 600000, timeout: 0};

function successCallback(position)
{
	console.log(position);
}

function errorCallback(error)
{
	console.log(error);
}

navigator.geolocation.getCurrentPosition(successCallback, errorCallback, options);

Responses

0 Replies