简体   繁体   English

手机不移动时生成一个位置

[英]Generating one location while the phone is not moving

I would like to know how can I generate one location using the gps or network providers while the phone is not moving more then something like 10 meters which means you at home, or in the same place. 我想知道如何在GPS移动距离不超过10米的情况下使用gps或网络提供商生成一个位置 ,这意味着您在家中或在同一地方。

The minTime parameter doesn't really matters I guess (speaking about the requestLocationUpdates method of course), the minDistance is the one that should make the diffrence. 我猜,minTime参数实际上并不重要(当然是关于requestLocationUpdates方法),minDistance是应该引起区别的一个。 I tried to set the value to 100m but I keep getting locations while my didn't moved(maybe 1 meter.. was tested while I were sleeping) so I kept raising the value and I stoped in 500 meters!! 我试图将值设置为100m,但是我一直保持位置,而我却没有动(可能是1米..我在睡觉时经过了测试),所以我一直在提高值,然后停在500米内! since it became useless. 因为它变得没用了。

Maybe there is a way to check the distance between 2 locations?or receiving information about the phone movement? 也许有一种方法可以检查两个位置之间的距离或接收有关电话移动的信息?

Bear in mind that GPS precision is on the order of +/- 20 meters. 请记住,GPS精度约为+/- 20米。 That, plus possible fluctuations in the available satellite signals due to environmental conditions, means that there is going to be some amount of change in the reported position, even for a stationary device. 这加上环境条件导致可用卫星信号的可能波动,意味着即使对于固定设备,报告位置也会发生一些变化。

The only reason minDistance would not be working for you is if it is feeding you positions where the reported positions are less than the minimum distance you requested. minDistance对您不起作用的唯一原因是,如果它正在为您提供的位置小于报告的最小距离,则该位置将为您提供位置。 LocationManager can only work with the reported positions; LocationManager只能处理报告的位置; it has no other way to determine whether or not the device is actually moving. 它没有其他方法可以确定设备是否在移动。

If you examine the data you get in your LocationListener , and you can demonstrate that the device is ignoring the minDistance parameter, report the bug to your device manufacturer. 如果检查在LocationListener获取的数据,并且可以证明设备忽略了minDistance参数,请将该错误报告给设备制造商。 If, on the other hand, the issue is that you are getting fixes because the GPS subsystem thinks the device is moving (and therefore the positions differ by more than minDistance ), that's a limitation of GPS and your hardware, and there is nothing you can do about that. 另一方面,如果问题是由于GPS子系统认为设备正在移动(因此位置相差超过minDistance )而导致您要修复的,这就是GPS和硬件的局限性,那么您将一无所获可以做到这一点。

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

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