juliano.net
juliano.net

Reputation: 8177

Google Maps current location marker and accuracy radius overlay

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.

Upvotes: 6

Views: 20736

Answers (3)

Oscar Calderon
Oscar Calderon

Reputation: 81

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);
        }
    }
}

Upvotes: 2

juliano.net
juliano.net

Reputation: 8177

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/

Upvotes: 10

BBonDoo
BBonDoo

Reputation: 766

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.

Upvotes: 0

Related Questions