7

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.

James
  • 710
  • 6
  • 19

2 Answers2

7

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.

James
  • 710
  • 6
  • 19
  • I hate to agree - but I had the same problem with "working" code. A phone reboot fixed it (Galaxy Nexus). So I wanted to support this answer, even though google might never admit it, there IS a bug somewhere in the system... thx for the hint. – Richard Le Mesurier Dec 06 '12 at 08:28
  • 2
    I also encountered this problem, on S3 with Android 4.1.1: Google Maps continues to work with NETWORK_PROVIDER, but all other apps (including mine) don't get any updates. Uninstalling and reinstalling the app does not help. Only fix is to reboot the phone, after which things work as expected. Here is a related post: [link](http://stackoverflow.com/questions/13594932/network-provider-not-providing-updated-locations). – Michael Pedersen Jan 13 '13 at 19:05
  • If you discover something new, let me know please =) – Guilherme Gregores Apr 08 '13 at 17:27
  • I wasted two days on this :( – saji159 Jun 16 '13 at 16:06
2

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.

rolve
  • 10,083
  • 4
  • 55
  • 75
Sinhyeok
  • 46
  • 4
  • This was driving me crazy. Sure this was the solution. Calling getLastKnownLocation() is necessary for the network provider, but not for the GPS provider. Thanks a lot! – Jav_Rock Oct 29 '14 at 12:07