nasch
nasch

Reputation: 5498

Android Google Maps - remove location accuracy circle

I'm displaying a Google map (v2 API) in an Android app like so:

mMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map))
                    .getMap();

Requesting location:

mLocationClient = new LocationClient(getApplicationContext(), this, this);
                mLocationClient.connect();

What I want to do is show just the marker for the current location, and not the circle indicating location accuracy. I've looked through the documentation and API reference, and searched around and haven't found an option to turn that off.

Upvotes: 1

Views: 6368

Answers (2)

user5157370
user5157370

Reputation: 1

I got rid of that annoying circle like this:

mMap.addMarker(new MarkerOptions().position(new LatLng(0, 0)).title("Marker").snippet("Snippet").icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_ORANGE)));

Upvotes: -1

Hanelore Ianoseck
Hanelore Ianoseck

Reputation: 614

The blue circle on the map is enabled eith the following line:

map.setMyLocationEnabled(true);

You only have to set it to false and it will disappear:

map.setMyLocationEnabled(false);

To draw your marker you need to get the users location using a listener. You can do something like this:

GoogleMap.OnMyLocationChangeListener locationListener = new GoogleMap.OnMyLocationChangeListener() {

            @Override
            public void onMyLocationChange(Location location) {


            drawMarker(location);

            private void drawMarker(Location location) {

                LatLng currentPosition = new LatLng(location.getLatitude(),
                        location.getLongitude());
                map.addMarker(new MarkerOptions()
                        .position(currentPosition)
                        .snippet(
                                "Lat:" + location.getLatitude() + "Lng:"
                                        + location.getLongitude())
                        .icon(BitmapDescriptorFactory
                                .defaultMarker(BitmapDescriptorFactory.HUE_AZURE))
                        .title("position"));

            }

        };

        map.setOnMyLocationChangeListener(locationListener);

You can also use your LocationClient and do the same if you need to.

Upvotes: 4

Related Questions