Start watching position after finish loading platform code

Skylar Ittner 3 years ago
parent ad869d1b97
commit de2acf34f7

@ -41,6 +41,7 @@ var geoerrorcount = 0;
var mapLocationControlStarted = false;
function setupPositionWatcher() {
if ("geolocation" in navigator) {
navigator.geolocation.watchPosition(function (position) {
userPosition.coords = position.coords;
@ -114,6 +115,7 @@ if ("geolocation" in navigator) {
});
}
}
}
/**
* Calculate distance between two GPS points using Vincenty Formula.

@ -169,12 +169,12 @@ function initCordova() {
});
}
// if (getStorage("runinbackground") == "true") {
// cordova.plugins.foregroundService.start('PackageHelper', 'GPS active');
// }
// Make sure the status bar color is set properly
applyColorTheme();
// start watching user position after everything's done, hopefully this will make it work
// with ios
setupPositionWatcher();
}, false);
openBrowser = function (url) {
cordova.InAppBrowser.open(url, '_blank', 'location=yes');
@ -266,6 +266,8 @@ function initNW() {
require('nw.gui').Shell.openExternal($(this).attr("href"));
evt.preventDefault();
});
setupPositionWatcher();
}
function initBrowser() {
@ -285,6 +287,8 @@ function initBrowser() {
window.open($(this).attr("href"), "_blank");
evt.preventDefault();
});
setupPositionWatcher();
}
function initPlatform() {

Loading…
Cancel
Save