[英]Location with GPS_PROVIDER
Sorry, I'm a beginner in android. 抱歉,我是android的初学者。 I have to save when a car parks using a service.
当停车场使用服务时,我必须保存。 To do this I'm using LocationManager with GPS_PROVIDER to monitor the speed of the car.
为此,我将LocationManager与GPS_PROVIDER配合使用以监视汽车的速度。 I am using requestLocationUpdates but when the machine stops onLocationChanged it is no longer called so I can not get the speed, understand that it is stationary and save the parking space.
我正在使用requestLocationUpdates,但是当机器停止onLocationChanged时,不再调用它,因此无法获得速度,请了解它是静止的并节省了停车位。 How could I do?
我该怎么办?
If you want continued updates while stopped you need to ensure 'minDistance' is not preventing updates. 如果要在停止时继续更新,则需要确保“ minDistance”不会阻止更新。 It is passed to your 'requestLocationUpdates' call.
它被传递到您的“ requestLocationUpdates”调用。 Try setting the value to 0. However this will also have a negative impact on battery life.
尝试将该值设置为0。但是,这也会对电池寿命产生负面影响。 I would also suggest looking into the location APIs provided by Google Play Services instead of using the LocationManager.
我也建议您研究Google Play服务提供的位置API,而不要使用LocationManager。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.