Start watching position after finish loading platform code
This commit is contained in:
parent
ad869d1b97
commit
de2acf34f7
@ -41,6 +41,7 @@ var geoerrorcount = 0;
|
|||||||
|
|
||||||
var mapLocationControlStarted = false;
|
var mapLocationControlStarted = false;
|
||||||
|
|
||||||
|
function setupPositionWatcher() {
|
||||||
if ("geolocation" in navigator) {
|
if ("geolocation" in navigator) {
|
||||||
navigator.geolocation.watchPosition(function (position) {
|
navigator.geolocation.watchPosition(function (position) {
|
||||||
userPosition.coords = position.coords;
|
userPosition.coords = position.coords;
|
||||||
@ -114,6 +115,7 @@ if ("geolocation" in navigator) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calculate distance between two GPS points using Vincenty Formula.
|
* 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
|
// Make sure the status bar color is set properly
|
||||||
applyColorTheme();
|
applyColorTheme();
|
||||||
|
|
||||||
|
// start watching user position after everything's done, hopefully this will make it work
|
||||||
|
// with ios
|
||||||
|
setupPositionWatcher();
|
||||||
}, false);
|
}, false);
|
||||||
openBrowser = function (url) {
|
openBrowser = function (url) {
|
||||||
cordova.InAppBrowser.open(url, '_blank', 'location=yes');
|
cordova.InAppBrowser.open(url, '_blank', 'location=yes');
|
||||||
@ -266,6 +266,8 @@ function initNW() {
|
|||||||
require('nw.gui').Shell.openExternal($(this).attr("href"));
|
require('nw.gui').Shell.openExternal($(this).attr("href"));
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
setupPositionWatcher();
|
||||||
}
|
}
|
||||||
|
|
||||||
function initBrowser() {
|
function initBrowser() {
|
||||||
@ -285,6 +287,8 @@ function initBrowser() {
|
|||||||
window.open($(this).attr("href"), "_blank");
|
window.open($(this).attr("href"), "_blank");
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
setupPositionWatcher();
|
||||||
}
|
}
|
||||||
|
|
||||||
function initPlatform() {
|
function initPlatform() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user