简体   繁体   English

使用Google Play Location API获取速度

[英]Getting Speed using Google Play Location API

I am using fused location provider from the new GooglePlay API(LocationClient class). 我正在使用新的GooglePlay API(LocationClient类)中的融合位置提供程序。 But the method Location.GetSpeed() is not returning correct speed (shows 0). 但是方法Location.GetSpeed()没有返回正确的速度(显示0)。 I read that I have to use LocationManager class to get the speed, but when I tried LocationManager a new problem occured. 我读到我必须使用LocationManager类来获得速度,但是当我尝试使用LocationManager时出现了一个新问题。 The location manager NetworkProvider is not working, here is a thread with the problem http://code.google.com/p/android/issues/detail?id=57707 . 位置管理器NetworkProvider不工作,这是一个问题http://code.google.com/p/android/issues/detail?id=57707的主题 So what is the best way to get the speed of movement. 那么什么是获得运动速度的最佳方法。 I tried calculating it distance/time but it is not accurate.. 我试过计算它的距离/时间,但它不准确..

The only sensor that delivers speed is GPS. 提供速度的唯一传感器是GPS。
Wlan and GSm cell Tower locatining cannot deliver speed. Wlan和GSm cell Tower定位无法提供速度。

If you need speed, you have to make sure that GPS is used exlusivley as Location Provider. 如果您需要速度,您必须确保使用GPS作为位置提供商使用exlusivley。 You cannot use NetworkProvider for that task. 您无法使用NetworkProvider执行该任务。

If speed is an important requirement, which has higher priority than battery consumption you have to stay with GPS Provider only. 如果速度是一项重要要求,其优先级高于电池消耗,则必须仅使用GPS提供商。 You have to avoid the fused location provider. 您必须避免融合位置提供程序。

Its technically not possible to have speed without GPS. 它在技术上不可能没有GPS的速度。

I also encountered this problem when I was using Google Play Location API, I hope this can help. 我在使用Google Play Location API时也遇到过这个问题,我希望这可以提供帮助。

It returns 0 because your device cannot get a lock on the GPS, or cannot connect to the GPS. 它返回0,因为您的设备无法锁定GPS,或无法连接到GPS。

I tried to get the speed using an older lenovo device and it returns 0 because it cannot lock on a gps. 我试图使用较旧的lenovo设备获得速度,并返回0,因为它无法锁定gps。

I tried using a samsung galaxy nexus and it returned my speed(has a better GPS sensor). 我尝试使用三星Galaxy nexus并且它恢复了我的速度(有一个更好的GPS传感器)。

The GPS sensor in your phone might not be good or you are in an area that has a weak GPS signal such as inside a house or building. 手机中的GPS传感器可能不太好,或者您所在的GPS信号较弱的区域(如房屋或建筑物内)。

Even if you use the locationManager to get the speed if you are not connected to the gps, your getSpeed will still return 0. 即使您没有连接到gps,也使用locationManager获取速度,getSpeed仍将返回0。

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

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