我正在与phonegap和cordova.js GPS相关的应用程序。我的应用在iOS中工作正常。在android中,每当我关闭GPS并重新启用它时,应用程序将无法识别GPS服务。我需要关闭并重新打开应用程序或使用location.reload(true)
来引用应用程序。为什么它是这样的。我正在使用下面的代码段。全球定位系统没有得到禁用和再次启用Android PhonePhone
refrshWatchPoss = setInterval(function() {
navigator.geolocation.getCurrentPosition(onWatchPositionSuccess, onWatchPositionError, options);
}, 5000);
function onWatchPositionError(err) {
window.plugins.toast.showLongBottom('App is waiting for location service! ', function (a) {
}, function (b) {
})
if (watchpositionErrorCount >= 9) {
messageAlert('Location service is unavailable. If it is unavailable after restarting then go to settings and reset your location services');
$.mobile.loading('show');
navigator.splashscreen.show();
setTimeout(location.reload(true), 2000);
}
watchpositionErrorCount++;
}