本文介绍了getLastKnownLocation不会对三星Galaxy S3 4.0.4工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些getLastKnowLocation code已经工作多年,但它不会对三星Galaxy S3 4.0.4工作。

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);
}

我注意到,如果我添加PASSIVE_PROVIDER,我得到一个位置,但我从来没有得到任何onLocationChanged。同样的code工作我已经从2.1测试了所有系统 - 4.1(除了我的CM10这似乎更糊涂了)

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?

我发现其他有类似问题的银河S3无GPS位置更新

I found others with similar problems No GPS location updates on Galaxy S3

推荐答案

我升级手机4.1的bug /功能消失了。

I upgraded the phone to 4.1 and the bug/feature disappeared.

这篇关于getLastKnownLocation不会对三星Galaxy S3 4.0.4工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!