Skip to content Skip to sidebar Skip to footer

How Would I Make My Google Maps App Start With Zoom On My Current Location

How would I make my google maps app on android start with zoom on my current location without pressing or doing anything? edit. problem solved Criteria cri= new Criteria(); Str

Solution 1:

Problem solved

Criteria cri= newCriteria();
Stringbbb= locationmanager.getBestProvider(cri, true);
LocationmyLocation= locationmanager.getLastKnownLocation(bbb);

double lat= myLocation.getLatitude();
doublelong= myLocation.getLongitude();
LatLngll=newLatLng(lat, long);

mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(ll, 20));

Solution 2:

you could do it this way

CameraUpdate center= CameraUpdateFactory.newLatLng(new LatLng(lat,long));
CameraUpdate zoom=CameraUpdateFactory.zoomTo(5);

map.moveCamera(center);
map.animateCamera(zoom);

Post a Comment for "How Would I Make My Google Maps App Start With Zoom On My Current Location"