Search code examples
androidgoogle-mapsgoogle-maps-android-api-2google-maps-api-2

Can I exploit Google's implementation of getting the user location?


Ok the answer to my question is probably rather simple so let's get to it:

Is it possible to get the user's location directly from the Google Map like the myLocationLayer does it?

To be a bit more precise: I know that there are various possibilities to get the user location and that they are explained wonderfully in answers here on SO like this one. But the Maps API v2 seems so simple and it has so many nice gettters and setters that I can't but wonder if there isn't one to just set

GoogleMap.animateCamera(CameraUpdateFactory.goToUserLocation());

and let Google handle the satellite and network part. They already have the location (you can click on the myLocationsButton and go there immediately) so I would be rather suprised if this is not possible programmatically... But I did not find anything in the API v2 tutorial.

Thanks very much for your input


Solution

  • You may use GoogleMap.getMyLocation(). Note that it is depracted, but IMHO it should not be.