phonegapでGPSがオンかオフかを検出する最良の方法はどれですか?
私はこれを使用しています: https://github.com/BastienL/GPSDetectorとうまく動作します。
Android 4.x ではすべて正常に動作しますが、Android 2.x では問題があります。
問題は次の行にあるようです。
gpsDetect = cordova.require('cordova/plugin/gpsDetectionPlugin');
このエラーで:
02-26 22:54:59.181: E/Web Console(821): module cordova/plugin/gpsDetectionPlugin not found at undefined:0
私のコード:
//Check GPS On/Off
function checkGPS(){
var gpsDetect = cordova.require('cordova/plugin/gpsDetectionPlugin');
gpsDetect.checkGPS(onGPS, onGPSError);
}
function onGPS(r){
if(!r){
Backbone.history.navigate('/errors/gps/', {trigger: true});
return;
}
return true;
}
function onGPSError(){
Backbone.history.navigate('/errors/gps/', {trigger: true});
return;
}
ヒント/アイデアはありますか?
ありがとう。