简体   繁体   English

问:Cordova Phonegap地理位置获得正确的速度?

[英]Q: Cordova Phonegap Geolocation getting the right speed?

I made an app that tracks users location now i need to get the speed also. 我制作了一个可以跟踪用户位置的应用,现在我还需要提高速度。 I manage to put position.coords.speed but it always shows 0. I noticed that the gps tracker/icon is not actively tracking. 我设法放置position.coords.speed但始终显示为0。我注意到gps跟踪器/图标未处于主动跟踪状态。 What is the best practice on tracking the speed of the user? 跟踪用户速度的最佳实践是什么? I am using the plugin cordova-plugin-geolocation 我正在使用插件cordova-plugin-geolocation

Have you requested high accuracy in the options when requesting location? 请求位置时,您是否要求选项的准确性高? For example: 例如:

navigator.geolocation.watchPosition(onSuccess, onError, {
  enableHighAccuracy: true,
  timeout: 30000,
  maxAge: 0
});

If position.coords.speed is zero and the gps/location icon is not shown in the taskbar, this might be the cause. 如果position.coords.speed为零,并且任务栏中未显示gps / location图标,则可能是原因。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM