0

In my Service I track my location every X minutes. I Try with

LocationManager lm=(LocationManager)getApplicationContext().getSystemService(LOCATION_SERVICE);
Criteria criteria = new Criteria();
criteria.setAccuracy(Criteria.ACCURACY_COARSE);

criteria.setAltitudeRequired(false);
criteria.setBearingRequired(false);        
String provider=lm.getBestProvider( criteria, true );
if (provider!=null){

    lm.requestLocationUpdates(provider,5000,1,locationListenerNetwork);
}

Using Network location, and if it's not avaible i try with gps location.

The problem is that when provider is avaible, i try to ask for a location with

lm.requestLocationUpdates(provider,5000,0,locationListenerNetwork);

where LocationListenerNetwork is my LocationListener, but nothing happends, my

onLocationChanged(Location location)

inside LocationListenerNetwork is never called

If I Use GPS (with ACCESS_FINE_LOCATION permissions) onlocationchanged is called and everything works fine.

This happends only in Galaxy S3 jb (4.1). (correctly setted) Before update, and on other smartphones, everything works fine:

I Tried on

  • Galaxy Nexus 4.2
  • Galaxy Nexus 4.1
  • Nexus S 4.1
  • Galaxy S
  • Galaxy Note

Everywhere my code works fine, but in S3 JB I can't understand how to solve. Another strange thing is that gmaps perfectly tracks position also without gps, so it can't be a device problem.

Dipak Keshariya
  • 22,193
  • 18
  • 76
  • 128
Rabarama
  • 73
  • 1
  • 5
  • Same Problem: http://stackoverflow.com/questions/15747543/locationlistener-of-network-provider-is-enabled-but-onlocationchanged-is-never if you discover something new, let me know please – Guilherme Gregores Apr 08 '13 at 17:40

1 Answers1

0

This is not really an answer, but it might help....

As per this post: Has NETWORK_PROVIDER behavior changed in Android 4.1.1?

I and he had similar problem on Galaxy Nexus - and a reboot fixed the problem.

Community
  • 1
  • 1
Richard Le Mesurier
  • 29,432
  • 22
  • 140
  • 255