当我尝试在我的 HTML 页面中获取我的地理位置时,我收到以下错误:错误代码:2 错误消息:最后一个位置提供程序不再可用这里是我的代码:
// onSuccess Callback
// This method accepts a `Position` object, which contains
// the current GPS coordinates
//
var onSuccess = function(position) {
};
var HospitalsRecord = [];
//onError Callback receives a PositionError object
//
function onError(error) {
alert('code: ' + error.code + '\n' +
'message: ' + error.message + '\n');
}
// Cordova is ready
//
function onDeviceReady() {
navigator.geolocation.getCurrentPosition(onSuccess, onError, { maximumAge: Infinity, timeout: 15000, enableHighAccuracy: true });
}
// Wait for Cordova to load
//
document.addEventListener("deviceready", onDeviceReady, false);
</script>
为什么会这样?
提前致谢
科比