I am setting:
map.setMyLocationEnabled(true)
But I am wondering what this really does. What I know:
Here is my concern. I am writing a location aware app but I am concerned about battery. Elsewhere in my app (via preferences) I set up a LocationManager and listen for location events so I can log them. But part of my preferences is the accuracy at which I get updates and the interval.
When I turn off my LocationManager:
locationManange.removeUpdates(LocationListener listener);
I expect to turn off location services for the entire app. Yet I still see the little GPS icon in my phones header bar indicating the app is getting location updates. I know that is coming from the fact that I set this on my map view:
map.setMyLocationEnabled(true);
I originally thought that if you did not listen for Location updates by setting up a LocationManager that set map.setMyLocationEnabled(true) would have no effect (ie no my location icon, or button). However that is not true.
Does that mean that by calling map.setMyLocationEnabled(true) google is setting up its own LocationManager with its own settings? I would really like to call map.setMyLocationEnabled(true), but have it use my settings for location updates not whatever google is doing under the hood. Is that possible? Did I miss something in the docs? I cannot find anything about the accuracy or interval that is setup on a LocationManager when I call map.setMyLocationEnabled(true).
Does that mean that by calling map.setMyLocationEnabled(true) google is setting up its own LocationManager with its own settings?
Not exactly. Maps V2 uses LocationClient
by default.
I would really like to call map.setMyLocationEnabled(true), but have it use my settings for location updates not whatever google is doing under the hood. Is that possible?
You can use setLocationSource()
to supply your own location data for use with the my-location layer. Here is a sample project demonstrating this.