在浏览器中,此插件可以正常运行,但在真正的android设备上,它会不断出现超时错误。我共享代码。我不明白问题是什么
function onRequestSuccess()
{
loader.show();
navigator.geolocation.getCurrentPosition(geolocationSuccess,geolocationError,
{ timeout: 10000 , enableHighAccuracy: getLocationAccuracy() , maximumAge:Infinity } );
}
function onRequestFailure(error){
//alert("Accuracy request failed: error code="+error.code+"; error message="+error.message);
/*if(error.code == 4){
toastMsg( getTrans("You have choosen not to turn on location accuracy",'turn_off_location') );
getCurrentLocation();
} else {
toastMsg( error.message );
}*/
toastMsg( error.message );
}
function getCurrentLocationOld()
{
CheckGPS.check(function win(){
//GPS is enabled!
loader.show();
navigator.geolocation.getCurrentPosition(geolocationSuccess,geolocationError,
{ timeout:100000 , enableHighAccuracy: true});
},
function fail(){
//GPS is disabled!
var m_1= getTrans('Your GPS is disabled, this app needs to be enabled to work.','your_gps');
var m_2= getTrans('Use GPS for location.','use_gps_for_location');
var m_3= getTrans('Improve location accuracy','improve_location_accuracy');
var b_1= getTrans('Cancel','cancel');
var b_2= getTrans('Later','later');
var b_3= getTrans('Go','go');
cordova.dialogGPS( m_1 ,//message
m_2,//description
function(buttonIndex){//callback
switch(buttonIndex) {
case 0: break;//cancel
case 1: break;//neutro option
case 2: break;//user go to configuration
}
},
m_3+"?",//title
[b_1, b_2, b_3]
);//buttons
});
}