Sunday, December 30, 2012

Display my location on Google Maps Android API v2

To display my location on Google Maps Android API v2, call setMyLocationEnabled(true) method of the GoogleMap acquired in last exercise "Get GoogleMap from MapFragment/SupportMapFragment".

While enabled, the my-location layer continuously draws an indication of a user's current location and bearing, and displays UI controls that allow a user to interact with their location (for example, to enable or disable camera tracking of their location and bearing).


Display my location on Google Maps Android API v2

The series:
A simple example using Google Maps Android API v2, step by step.


Mathew Morford said...

I was wondering if you could help me with this particular post. I can't seem to get my location to work. I got the map up and I am able to see it on my device, but I can't get the code right I guess.

I have some code I got off another site which has something similar in it. " mMap.setMyLocationEnabled(true) " . I can't get it to say myMap.setMyLocation... It says its an error. But there are no errors with any code on my app. But it's ok with it just being mMap... So I'm leaving that part, but I still can't get it to work. Can you help?

Anonymous said...

hmmm i have question.. where i can put this code? beside that, we must declare mymap first?

Andr.oid Eric said...

hello Anonymous,

It a step by step exercise, read here:

Jaime Bautista Leonardoo said...

excelente me ayudo la linea :)