plugins icon indicating copy to clipboard operation
plugins copied to clipboard

Google Maps myLocationEnabled

Open maddockst opened this issue 3 years ago • 1 comments

Hi,

I'm trying to enable the "My Location" button. This worked previous but now appears to not work. Any ideas what I may be doing wrong?

onMapReady({ map }: { map: GoogleMap }) {
    geolocation.enableLocationRequest(false, true)
        .then(() => {
            geolocation.isEnabled().then(isEnabled => {
                if (!isEnabled) {
                    return;
                }

                map.myLocationEnabled = true;
            });
        });
}

maddockst avatar Apr 09 '22 19:04 maddockst

@maddockst you need to use a custom LocationSource https://developers.google.com/android/reference/com/google/android/gms/maps/GoogleMap#setLocationSource(com.google.android.gms.maps.LocationSource)

farfromrefug avatar Apr 14 '22 12:04 farfromrefug