Android Make Disappear or remove the blue dot on the map v2
Asked Answered
B

1

8

I'm trying to replace the blue dot on the map of my app. My intention is that instead of the usual blue dot, show an icon shaped plane. I achieve this and it works perfectly as follows:

//...
GoogleMap.OnMyLocationChangeListener myLocationChangeListener = new GoogleMap.OnMyLocationChangeListener() {
            @Override
            public void onMyLocationChange(Location location) {
                LatLng loc = new LatLng(location.getLatitude(), location.getLongitude());

 try{
                    myPositionMarker.remove();
                } catch (Exception e){
                 //..
                }

                myPositionMarker = mMap.addMarker(new MarkerOptions()
                        .flat(true)
                        .icon(BitmapDescriptorFactory
                                .fromResource(R.drawable.plane))
                        .anchor(0.5f, 0.5f)
                        .position(
                                new LatLng(location.getLatitude(), location
                                        .getLongitude())));
//...
}

As I said, this works fine, but now I see my icon and the blue dot:

enter image description here

I have tried many ways to do it, but can not find any that work. There are many examples of removing the button "My Location" but I do not want to delete it.

I want to remove the blue dot.

enter image description here

I appreciate any help. Thanks in advance and greetings

*UPDATE:

Responding to the comment written by @tyczj i'm removing my location button as follows:

mMap.setMyLocationEnabled(true);
mMap.getUiSettings().setMyLocationButtonEnabled(false);

Thus, my location button is not visible, but the blue dot is visible. Change the two boolean to false and then no longer works. No blue dot, but neither location update. I'm a little confused. What am I doing wrong?

Thanks

Baize answered 23/2, 2015 at 17:35 Comment(2)
you cannot remove the blue dot without removing the my location button, you need to have your own button that does the same thing thenSideslip
Even without Google's location button removing the blue dot does not seem possible.Ghibelline
A
9

If you want to have "google's go-to-my-location-button" you have to have "google's blue dot". If you don't want "google's blue dot" you also will not have "google's go-to-my-location-button" and thus you'll have to implement it by yourself. Just add requestLocationUpdates (GoogleApiClient client, LocationRequest request, LocationListener listener) to track user location and add your custom "go-to-my-location-button" on top of map.

Albacore answered 25/2, 2015 at 9:15 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.