requestLocationUpdates with Criteria不起作用

时间:2015-05-08 07:23:10

标签: android location

以下是代码:

Criteria criteria = new Criteria();
criteria.setAccuracy(Criteria.ACCURACY_FINE);
criteria.setPowerRequirement(Criteria.POWER_LOW);
criteria.setAltitudeRequired(false);
criteria.setBearingRequired(false);
criteria.setSpeedRequired(false);
LocationManager manager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
manager.requestLocationUpdates(0,0, criteria, locationListener, null); // doesn't work

如果我将条件作为参数传递,则监听器永远不会得到更新。但是,如果我从cirteria获得提供者并传递给请求locationUpdates的不同参数,则它可以正常工作

manager.requestLocationUpdates(manager.getBestProvider(criteria, true), 0, 0, locationListener); // works

API中的manager.requestLocationUpdates(0,0, criteria, listener, looper)方法是否已中断?

0 个答案:

没有答案