Cordova watch位置速度



我开发了一个应用程序,它使用watchposition来获得速度。

但是当我在我的车里使用我的应用程序时,速度永远不会回到0。

onDeviceReady: function() {
    initPushwoosh();
    id = navigator.geolocation.watchPosition(successCallback, errorCallback, {enableHighAccuracy:true, maximumAge:0, timeout:250});

有解决办法吗?

谢谢

我用这个源代码检查速度:

  var speed_convert = position.coords.speed || null;
      if(isNaN(parseFloat(speed_convert)) || speed_convert <= 0 || speed_convert == null)
        speed_convert = 0;
      else {
        speed_convert = speed_convert * 3.6;
        speed_convert = Math.round(speed_convert);
      }

但速度永远不会回到0

最新更新