I have some getLastKnowLocation code that has worked for years, but it does not work on the Samsung Galaxy S3 4.0.4.
Location location = null;
locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
Criteria criteria = new Criteria();
String provider = locationManager.getBestProvider(criteria, true);
// The S3 returns null here (even though location is enabled), google maps works.
try {
location = locationManager.getLastKnownLocation(provider);
} catch (IllegalArgumentException e) {
}
if ( location == null ) { // only S3 gets this....
location = locationManager.getLastKnownLocation(LocationManager.PASSIVE_PROVIDER);
}
I have noticed that if I add PASSIVE_PROVIDER, I do get an location, but I never get any onLocationChanged. The same code works on all system I have tested from 2.1 - 4.1 (except my CM10 which seems even more confused)
Any ideas on what is going on? Bug/Feature?
I found others with similar problems No GPS location updates on Galaxy S3