Iv made a location app, when I open it it opens on a map of the world and I have to hit the target icon thing in the top right hand corner for it to zoom into user location, how do I make it automatically zoom to user location when app is opened?
Android studio location
1.7k views Asked by Colin Malone At
2
There are 2 answers
0
On
You can use CameraPosition
to show users location.
CameraPosition cameraPosition = new CameraPosition.Builder ()
.target (curentpoint).zoom (10f).tilt (70).build ();
Where target
is current LatLog
getting from either gps
or network
.
zoom
will Zoom map to 10. tilt will change map's angle.
after that use animateCamera
method to add cameraposition.
mGoogleMap.animateCamera (CameraUpdateFactory
.newCameraPosition (cameraPosition));
I hope this is what you want.