我从网络提供商(GSM)获取位置坐标,但是每次位置更新之间的时间间隔很长,这使得我使用这些点的用户的路线显示非常模糊。我尝试过
locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, locationListener);
,即使设备没有移动,也会导致持续更新,但是当移动更新仅以很长的间隔进行时,这是我不需要的。
所以我尝试了
locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 1, locationListener);
,现在我在很长的间隔内得到坐标更新。
我读到 TIME_DURATION、DISTANCE 只是对位置管理器的提示。
请告知一种仅在设备移动时以 1 分钟为间隔从 NETWORK_PROVIDER 获取位置更新的方法。
I am getting location coordinates from Network provider(GSM), but the time interval between each location update is very long, which make my route display of the user using these points very vague. i tried
locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, locationListener);
which results in continuous update even the device not moving, but when moving updates are coming in long interval only, which i do not required.
So i tried
locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 1, locationListener);
and now i am getting coordinate update in very long interval.
I read that the TIME_DURATION, DISTANCE are only a hint to the location manager.
Please tell a way to get the location update from NETWORK_PROVIDER in 1 min interval, only when the device is moving.
发布评论