LocationManager locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
Criteria criteria = new Criteria();
Location location = locationManager.getLastKnownLocation(locationManager.getBestProvider(criteria, false));
googleMap.setMyLocationEnabled(true);
LatLng place = new LatLng(location.getLatitude(), location.getLongitude());
Log.d("Location", String.valueOf(place));
CameraUpdate locations = CameraUpdateFactory.newLatLngZoom(
place, 14);
googleMap.animateCamera(locations);
此代码的第一行将蓝色点放在地图上的正确位置,但是当地图对缩放进行动画处理时,它将放大到错误的位置(相距不远,可能约为0.2-0.5英里)。