Android getLastKnownLocation不适用于三星Galaxy S3 4.0.4

Android getLastKnownLocation不适用于三星Galaxy S3 4.0.4,android,location,Android,Location,我有一些已经使用多年的getLastKnowLocation代码,但它在三星Galaxy S3 4.0.4上不起作用 Location location = null; locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); Criteria criteria = new Criteria(); String provider = locationManager.getBestProvide

我有一些已经使用多年的getLastKnowLocation代码,但它在三星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);
}
我已经注意到,如果我添加被动_提供者,我确实会得到一个位置,但我从来没有得到任何onLocationChange。相同的代码适用于我从2.1到4.1测试的所有系统(除了我的CM10,它看起来更混乱)

有什么想法吗?缺陷/功能


我发现其他人也有类似的问题

我将手机升级到4.1,错误/功能消失。

这与Android版本无关,我的代码在Galaxy Nexus 4.2.2上运行,而不是在S34.1或Sony XPeria 4.0.4上运行


我怀疑GPS位置没有检测到你(这需要时间和良好的GPS信号),在我的应用程序中,当我发现GPS没有重新发送或未启用时,我切换到网络检测(对于我必须搜索半径为10公里的设备的情况,约45米的精度不是那么差)

这不是答案,您的答案应该解释问题发生的原因和/或解决方法