First try to get location at all. Compile below Tizen 4. Since Tizen 4 app has to handle permissions.
Then you can use this code:
var options = {
enableHighAccuracy: false,
maximumAge: 1000 * 15,
timeout: 20000,
};
try {
_locationID = navigator.geolocation.watchPosition(onLocationChanged, onLocationError, options);
} catch(e) {
alert('Geolocation Error: ' + e.message + " [" + e.name + "]");
}
function onLocationChanged(pos) {
var your_coordinates = pos.coords;
}
function onLocationError(error) {
console.error('error msg ' + error.message);
}
it definitely works. After that try with Tizen 4 and add permission handling and check errors then if any.