对象全局没有方法' requestHighAccuracy'

时间:2016-07-26 17:45:58

标签: javascript

这是我的代码:

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时遇到错误。为什么会发生这种情况,哪种方法可以实现呢?

0 个答案:

没有答案