我想知道在Android设备中使用phonegap打开gps。
我试过
navigator.geolocation.getCurrentPosition(function onSuccess(position){
console.log("The gps is availabile");
},
function geolocationError(error){
console.log("The geo error : " + error.code +"code : " + PositionError.PERMISSION_DENIED);
if( error.code == PositionError.PERMISSION_DENIED ){
alert("Please turn on your gps to start the trip");
}else{
console.log("Gps is turned on. but not availabile");
}
},{enableHighAccuracy: true , timeout:10000 });
但是当gps关闭时,我从未得到PositionError.PERMISSION_DENIED
错误。始终显示PositionError.POSITION_UNAVAILABLE
。如何识别gps是打开/关闭的?(不是gps可用或不可用)