Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Has NETWORK_PROVIDER behavior changed in Android 4.1.1?

I have an existing well-tested app that utilizes the GPS_PROVIDER and NETWORK_PROVIDER with the same LocationListener.

LocationManager reports gps, network, and passive location providers are available and enabled.

I have recently upgraded my Galaxy Nexus to 4.1.1 and now the NETWORK_PROVIDER does not deliver any location changes. Testing with an Galaxy S III running 4.0.4 works as I am accustomed to, with network location updates coming through, even if WiFi is turned off. When WiFi is turned off, I get the cell tower position.

Talking with colleagues here, I can't rule out some kind of coincidental hardware failure or some sort of default setting change that I haven't found. I've double checked throughout the settings and it appears that everything is properly set.

WiFi is on, Cell network is on, GPS is on, network services are all enabled. I have no GPS signal at my desk, so it's easy to notice when the network location fails to provide a result.

Anyone else running into similar issues with Verizon Galaxy Nexus + 4.1.1, or 4.1.1 and any phone?

As an additional wrinkle, Google Maps is finding my location, but my PASSIVE_PROVIDER is not generating a location either.

like image 995
James Avatar asked Sep 27 '12 21:09

James


2 Answers

The behavior of Android has not changed with regard to the NETWORK_PROVIDER.

I don't know what went wrong or why, but I removed/replaced the battery and SIM card on my Galaxy Nexus and the network provider seems to be providing the correct results.

The lesson for me? Do not assume you will ever get a location reported to your listener, even if you are certain that the network provider is available, enabled and connected.

In my case, I'll need to add another check to make sure my LocationListener does not keep running if I do not get any locations reported.

like image 159
James Avatar answered Nov 03 '22 00:11

James


I have read someone's supposition about this problem. It is "In some devices if there is no update after request then a network provider do not give a callback".

Consider that possibility.

In my case, I use a getLastKnownLocation() before starting a current location tracking. Try ctrl+f getLastKnownLocation in this article.

like image 28
Sinhyeok Avatar answered Nov 03 '22 00:11

Sinhyeok