|
|
|
@ -19,32 +19,40 @@ var getLocation = function (success, error) {
|
|
|
|
|
navigator.geolocation.getCurrentPosition(function (position) {
|
|
|
|
|
success(position);
|
|
|
|
|
}, function (err) {
|
|
|
|
|
if (typeof error == "function") {
|
|
|
|
|
error(err.message);
|
|
|
|
|
}
|
|
|
|
|
}, {
|
|
|
|
|
enableHighAccuracy: true,
|
|
|
|
|
timeout: 5000,
|
|
|
|
|
maximumAge: 0
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
if (typeof error == "function") {
|
|
|
|
|
error("Location is unavailable.");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var watchLocation = function (success, error) {
|
|
|
|
|
if ("geolocation" in navigator) {
|
|
|
|
|
navigator.geolocation.watchPosition(function (position) {
|
|
|
|
|
success(position);
|
|
|
|
|
}, function (err) {
|
|
|
|
|
if (typeof error == "function") {
|
|
|
|
|
error(err.message);
|
|
|
|
|
}
|
|
|
|
|
}, {
|
|
|
|
|
enableHighAccuracy: true,
|
|
|
|
|
timeout: 5000,
|
|
|
|
|
maximumAge: 0
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
if (typeof error == "function") {
|
|
|
|
|
error("Location is unavailable.");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function initCordova() {
|
|
|
|
|
platform_type = "cordova";
|
|
|
|
|