这是我的代码:
function gpsManager() {
}
gpsManager.prototype = {
/*
* We need High Accuracy.
*/
requestHighAccuracy: function(cb) {
if(cb)
this.callback = cb;
cordova.plugins.locationAccuracy.request(this.callback, this.onRequestFailure, cordova.plugins.locationAccuracy.REQUEST_PRIORITY_HIGH_ACCURACY);
},
onRequestFailure: function(error) {
console.error("Accuracy request failed: error code="+error.code+"; error message="+error.message);
if(error.code == 4)
this.requestHighAccuracy(null);
}
}
我在调用requestHighAccuracy时遇到错误。为什么会发生这种情况,哪种方法可以实现呢?