如何获取Android设备用户移动的速度?Location.getSpeed 可靠吗? [英] How to obtain the speed that the user of an Android device is moving? Is Location.getSpeed reliable?

查看:13
本文介绍了如何获取Android设备用户移动的速度?Location.getSpeed 可靠吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从他们的 Android 设备获取用户的速度,但哪种方法最可靠?

I am trying to get the user's speed from their Android device, but which is the most reliable way to do it?

有使用GPS的location.getSpeed()函数;这是获得速度的可靠方法吗?我是否应该使用获得的 GPS 坐标手动计算速度?还是我缺少其他方法来完成此操作?

There is the location.getSpeed() function that uses GPS; is this a reliable way to obtain the speed? Should I instead calculate speed manually using GPS coordinates obtained? Or is there another way that I'm missing to accomplish this?

推荐答案

似乎getSpeed()方法并不总是可靠的,尤其是在低速和gps覆盖不是最佳的情况下.你可以看看 这个问题这个 这两个都是关于 getSpeed() 的替代方案.android 开发者页面 但是说你会得到更好的性能使用 Google Location API.

It seems that the getSpeed() method is not always reliable, especially at low speed and when gps coverage is not optimal. You can have a look at this question and this one which are both about alternatives for getSpeed(). The android developper page however says that you'll get better performance by using the Google Location API.

因此,选择似乎取决于您的应用程序的使用情况:如果您的目标是在 GPS 覆盖范围较差的区域(在树林中行走)进行缓慢位移,请使用您自己的实现.在 GPS 覆盖范围广的区域内快速运行,请使用 Google Location API.

So it appears that the choice is depending on the usage of your app: if you target slow displacement in area with poor gps coverage (walking in the wood), use your own implementation. Fast in area with good GPS coverage, use the Google Location API.

这篇关于如何获取Android设备用户移动的速度?Location.getSpeed 可靠吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆