【发布时间】:2016-02-15 13:28:44
【问题描述】:
我试过FusedLocationAPI,但是它返回的精度比setMyLocationEnabled(true)高,所以结果如下,蓝色圆圈是setMyLocationEnabled,黑色圆圈是精度由FusedLocationAPI绘制。
这段代码我也用过
LocationManager lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
Location myLocation = lm.getLastKnownLocation(LocationManager.GPS_PROVIDER);
if (myLocation == null) {
Criteria criteria = new Criteria();
criteria.setAccuracy(Criteria.ACCURACY_COARSE);
String provider = lm.getBestProvider(criteria, true);
myLocation = lm.getLastKnownLocation(provider);
}
LatLng myPos = new LatLng(myLocation.getLatitude(), myLocation.getLongitude());
googleMap.addMarker(new MarkerOptions().position(myPos).title("Start"));
但是绘制的标记又离他太远了setMyLocationEnabled(true)就像这样
所以我想知道是否有更好的方法来更准确地获取位置?
【问题讨论】:
标签: android api google-maps location maps