Android network location takes hours to update location

為{幸葍}努か 提交于 2019-12-19 08:55:06

问题


In my android app I use the network provider to receive location updates in a location listener and sync them to my server. When testing, I'll take the device and drive a few hours away and com back the next day.

The problem is the listener sometimes takes a few hours to give me an updated location. I'll leave point A and get to point B and it takes 3 hours for the device to report B as the new location. The same happens the next day going from point B back to A.

It seems odd that it's talking so long to update the location. The distance filter is 600m and 10 minute time interval. Is three hours about the best I can expect from using the network provider?

On a side note, it all works perfectly using gps.


回答1:


I don't know what your code is doing (it would be helpful to see your code) but try this to get a quick location update when you first start your location updates:

Location networkLocation = locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);

The distance filter and the time interval settings are suggestions, not instructions, so it's possible that it's ignoring these suggestions.



来源:https://stackoverflow.com/questions/6299183/android-network-location-takes-hours-to-update-location

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!