你好,我是完全新的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 –