6

How can I display a blinking ellipsis and a circle demonstrating user's current location and the accuracy (blue overlay) on Google Maps Android API v2?

To be more specifically, how can I have an animated drawable like the one Google uses? And how can I display a circle as a blue overlay (25% alpha or something like)?

Thanks.

juliano.net
  • 7,982
  • 13
  • 70
  • 164

3 Answers3

10

Actually, the solution is simpler than I thought.

When using Google Maps Android API v2, the GoogleMap object has a method called setMyLocation. If you set it to true, the my-location layout of the Maps API will be activated and it will display this blue ellipsis or an arrow indicating the bearing.

If you need to automatically move the camera to the user's location when the activity is created, you need to follow this article: http://discgolfsoftware.wordpress.com/2012/12/06/google-maps-android-api-v2-mylocation-locationsource-and-event-handling/

juliano.net
  • 7,982
  • 13
  • 70
  • 164
  • What did you have to change in order to get the arrow? Is there a way to get the blinking? – Steven Feb 14 '13 at 17:14
  • 1
    @Steven this is done automatically by the API when it detects that the user is moving. You just need to call setMyLocation(true). – juliano.net Feb 16 '13 at 16:07
2

setup your map with setMyLocationEnabled(true) for example:

private void setUpMapIfNeeded() {
    // Do a null check to confirm that we have not already instantiated the map.
    if (mMap == null) {
        // Try to obtain the map from the SupportMapFragment.
        mMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map))
                .getMap();
        // Check if we were successful in obtaining the map.
        if (mMap != null) {
            mMap.setMyLocationEnabled(true);
            mMap.setOnMyLocationButtonClickListener(this);
        }
    }
}
0

I think that you want to let the default attributes implemented in Google Maps modify. As you know, Google Maps provides many defaulted facilities on the map, such like My Location dot(market), A Big Circle around my location dot, etc.

To modify this defaulted attributes hidden in the Google Maps, please follow this steps;

1.In Eclipse, select your project and select DDMS(Window->OpenPerspective->DDMS).

2.In DDMS, click "FileExplorer" tab(in Right window) and find "System" in the "Name" column.

3.Navigate to the "system->app->Maps.apk" and you will find "Maps.apk". this is Google Maps app.

4.Select "Maps.apk" and click the small icon in the right-top of this "FileExplorer" tab. If you approach to this icon, you can get "Pull a file from the device" hint. Click this and download "Maps.apk" to your PC directory.

5.In your downloaded PC, change the file extension of the "Maps.apk" into "Maps.zip". Unzip the changed "Maps.zip" into the "Maps folder". You can see all the files of Maps.apk.

6.Navigate to the res folder in the unzipped folder, then you will get all drawable image and xml using in Google Maps currently.

7.That's all. This is HOW TO VIEW the Google Maps Resources.

  1. But to see all complete project file, you MUST decompile this app using the decompile Utils tool, but I don't try to explain HOW To USE this decompile toos here.
BBonDoo
  • 766
  • 5
  • 14
  • 1
    Not exactly what I need, I mean, I want to know how can I create animated drawables and how Google Maps Android API v2 allows to create a circle as an overlay with opacity. – juliano.net Jan 23 '13 at 11:27