【发布时间】:2014-01-06 18:34:29
【问题描述】:
我正在使用 Google Maps API V1。 我有这个错误:
java.lang.IllegalArgumentException: provider doesn't exisit: null
这是我的代码:
locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
Criteria criteria = new Criteria();
criteria.setAccuracy(Criteria.ACCURACY_FINE);
String provider = locationManager.getBestProvider(criteria, true);
if (provider != null)
{
startTime = System.currentTimeMillis();
geoLocTimeOutTask = new GeoLocTimeOutTask();
geoLocTimeOutTask.execute();
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, locationListener);
locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, locationListener);
}
else
{
geoLocCallbackObj.geoLocationCallback(tagCallback);
}
我理解错误,但我的问题是,为什么设备给我这个错误?我该如何避免这种情况?
【问题讨论】:
-
位置管理器跟google maps没关系,可能跟模拟器有关系
-
您在哪一行得到异常?
-
这里:locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, locationListener);
标签: android location location-provider