You need to do the geolocation after the device is ready. The following Jquery code, for example, will geolocate without that nasty alert:
$(function(){
document.addEventListener("deviceready", onDeviceReady, false);
})
function onDeviceReady() {
navigator.geolocation.getCurrentPosition(onSuccess, onError);
}
function onSuccess(position) {
// your callback here
}
function onError(error) {
// your callback here
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…