【发布时间】:2013-06-21 01:59:49
【问题描述】:
即使地图应用程序显示正确的位置,位置服务 getBestProvider 调用仍返回 null。 FINE_LOCATION 和 COARSE_LOCATION 的权限在清单中。
public static Location getLocation(Context context) {
LocationManager locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
Criteria criteria = new Criteria();
Location myLocation = locationManager.getLastKnownLocation(locationManager.getBestProvider(criteria, false));
return myLocation;
}
非常感谢任何帮助,因为这是我第一次使用定位服务。提前谢谢你。
【问题讨论】:
-
我猜你也在使用
标签: android google-maps android-location