Reputation: 9766
I have GoogleMaps V2 in android.
How can I center the map at my location and trace my location automatically, that if I moved, the map will set my new location in the center of the map. And how can I make that the circle of the accuracy will be in full size (all over the control)?
Upvotes: 0
Views: 415
Reputation: 22232
To track current location use LocationClient. More info here: http://developer.android.com/training/location/receive-location-updates.html
After you receive Location
update from it, you may want to call GoogleMap.animateCamera
to center on it.
To zoom on the circle, you need to know its size. Location.getAccuracy
will tell you that. Then you may use this ugly function of mine to calculate LatLngBounds
from center point and radius in meters, which can be put into animateCamera
for your desired result.
Upvotes: 1
Reputation: 1632
let's assume that the declared variable is GoogleMap mMap;
add these to your mMap
:
mMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);
mMap.setMyLocationEnabled(true);
after that, there will be a button at the top right position of your map, similar with the ones inside the google Maps application, press it, and your movement will be followed.
what do you mean with full size accuracy circle? the smaller the circle, the better your location accuracy.
Regards,
Reid
Upvotes: 0