Android network location takes hours to update loc

2020-03-24 06:41发布

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条回答
够拽才男人
2楼-- · 2020-03-24 06:49

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.

查看更多
登录 后发表回答