Xamarin.forms.googlemaps: Direct assign 'MyLocationButtonEnabled' value / result = no show

Created on 29 Oct 2017  路  13Comments  路  Source: amay077/Xamarin.Forms.GoogleMaps

BUG / PROBREM REPORT

SUMMARY

Directly assign value, result map itself never show the my location button.

VERSIONS

Xamarin.Forms.GoogleMaps = 2.2.0

PLATFORMS

  • [x] iOS

HOW TO REPRODUCE

  1. Your sample solution / on BasicMapPage.xsml.cs / comment out all code
    (from the comment marker '// MyLocationButtonEnabled' about line#65 until the end.)
    // MyLocationButtonEnabled switchMyLocationButtonEnabled.Toggled += (sender, e) => { map.UiSettings.MyLocationButtonEnabled = e.Value; }; switchMyLocationButtonEnabled.IsToggled = map.UiSettings.MyLocationButtonEnabled;

  2. Put on below line of code instead
    map.UiSettings.MyLocationButtonEnabled = true;

  3. My result the my location button never show.

bug in review

All 13 comments

Thank you for reporting.
It seems same as #371 .
I will fix it soon. 馃憤

I fixed this issue in v2.2.1-beta1 .
Could you try?

Fixed on Android? I just tested, and it's still not shown.

I can confirm also and even my position is not displayed.

I can see location button on iOS by below code with v2.2.1-beta1 and XFGoogleMapsSample.

    public partial class BasicMapPage : ContentPage
    {
        public BasicMapPage()
        {
            InitializeComponent();

            map.UiSettings.MyLocationButtonEnabled = true;
        }
    }

image

A was testing on android emulator and it is not showing with the same code

Thanks. I reproduced it. (I didn't run on Android because this issue is about iOS side)

A was testing on android emulator and it is not showing with the same code

This issue has 2 reasons.

  1. Design of GoogleMaps Android API - We should set Map.MyLocationEnabled = true and UiSettings.MyLocationButtonEnabled = true for display location button.
  2. Bug - Map.MyLocationEnabled = true in page constructor is not worked. This is my bug.

Conclusion

Add map.MyLocationEnabled = true in your page constructor.
And wait for next version(v2.2.1-beta2).

public partial class BasicMapPage : ContentPage
{
    public BasicMapPage()
    {
        InitializeComponent();

        map.MyLocationEnabled = true;  // <-- added
        map.UiSettings.MyLocationButtonEnabled = true;
    }
}

Dear @amay077
thanks for your afford, v2.2.1-beta2 works fine.

I released v2.2.1-beta2.
Could you try this?

@amay077 v2.2.1-beta2 = working fine

Is this bug closed?

Yes, it's closed.

@amay077 last version (2.2.1) MyLocationEabled works in Android but not in iOS (no blue dot, and no certer if you tap in MyLocationButton)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

galadril picture galadril  路  3Comments

mammadkoma picture mammadkoma  路  6Comments

non335 picture non335  路  7Comments

mtsrdr picture mtsrdr  路  6Comments

Gavrielo picture Gavrielo  路  3Comments