Currently i am creating an application for the samsung gear s smartwatch using tizen web application (javascript). My widget/app needs to get location data (it's a safety application) everywhere. The basic GPS location works fine as you can see in my code below. The problem is that GPS only works outside, since my app is a safety app i need to get location everywhere. On phones you are able to use Wifi and mobile network to get location. My question is is it possible to get location data using wifi or mobile network on a smartwatch (the samsung gear s has mobile network and wifi connection so you would think that it is possible)? and if it's possible how.
My code for the basic GPS location using HTML 5 geolocation:
function getBestGPSLocation(){
//GPS
navigator.geolocation.getCurrentPosition(success, error, {maximumAge:60000, timeout:5000});
//Wifi
//Mobile Network
}
function error(error) {
// just some error codes they work either
switch(error.code) {
case error.PERMISSION_DENIED:
console.log("permission denied");
break;
case error.POSITION_UNAVAILABLE:
console.log("your position is unavailable");
break;
case error.TIMEOUT:
console.log("a timeout occured");
break;
case error.UNKNOWN_ERROR:
console.log("an unknow error occured");
break;
}
}
function success(position) {
// this works i get all the data
alert(position);
alert(position.coords.latitude);
}