When I trying to get the location information like lat and long every time gives location information unavailable error. is it possible to get the location information from Tizen web API without pairing the phone? because I’m developing a standalone application and I just need to get details from my watch location settings.
below is the detail of what I did.
added the below privilege to the config file using the privileges tab first.
http://tizen.org/privilege/location
Then I make permission flow to enable the location for my standalone watch app.
// use to ask permission for the location
function findLocation(askPermission) {
var permisson_status = tizen.ppm.checkPermission("http://tizen.org/privilege/location");
if (askPermission && permisson_status === 'PPM_ASK') {
tizen.ppm.requestPermission("http://tizen.org/privilege/location", function(e) {
if (e === 'PPM_DENY_ONCE') {
} else if (e === 'PPM_ALLOW_FOREVER') {
return callGeoLocationService();
}
})
} else if (permisson_status === 'PPM_ALLOW') {
callGeoLocationService();
}
}
// call geolocation service
function callGeoLocationService() {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(
locationSuccessCallback, locationErrorCallback,{enableHighAccuracy: true,maximumAge: 0,timeout: 10000}
);
} else {
console.log('Geolocation is not supported.');
}
}
// when process success
function locationSuccessCallback(position) {
console.log([position.coords.latitude,position.coords.longitude]);
}
// when process error
function locationErrorCallback(error) {
switch (error.code) {
case error.PERMISSION_DENIED:
console.log('User denied the request for Geolocation.');
break;
case error.POSITION_UNAVAILABLE:
console.log('Location information is unavailable.');
break;
case error.TIMEOUT:
console.log('The request to get user location timed out.');
break;
case error.UNKNOWN_ERROR:
console.log('An unknown error occurred.');
break;
}
}
but unfortunately, my issue was not resolved to enable permissions too. and then I tried to manually enable location permissions from watch settings. same no success there. it’s not getting the GPS details. anyone can support this? it will be helpful to the community if you can provide the code snippets. Thanks!