如何识别gps是关闭phonegap android

时间:2013-02-13 09:27:45

标签: android cordova gps

我想知道在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可用或不可用)

0 个答案:

没有答案
相关问题