你好,我是完全新的Android位置概念,我已经在android studio中创建了一个地图活动。这是代码。获取当前位置Android API级别23
public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;
mMap.setMyLocationEnabled(true);
Location location = null;
LatLng currentPosition = new LatLng(location.getLatitude(), location.getLongitude());
mMap.addMarker(new MarkerOptions().position(currentPosition).title("Current Location"));
这是正确的@Abhishek
只需添加下列行:mMap.setMyLocationEnabled(真); – nikk
似乎它已经在这篇文章中回答http://stackoverflow.com/questions/3145089/what-is-the-simplest-and-most-robust-way-to-get-the-users-current-location-on- a?rq = 1 –
http://ramsandroid4all.blogspot.in/2015/05/showing-current-location-with-marker-in.html –