How to use Dark Mode Google Maps in Xamarin.Forms.Maps?

Viewed 546

I'm trying to use the Dark Mode Google Maps in my Xamarin.Forms app using the Xamarin.Forms.Maps nuget package.

I've managed to have Dark Mode on iOS Maps using this line of code in the CustomRenderer in the OnElementChanged if(e.NewElement != null) method:

nativeMap.OverrideUserInterfaceStyle= UIUserInterfaceStyle.Dark;

However I haven't been able to use it on Google Maps and wanted to know if there was anyway to get the same result and use Dark Mode Google Maps on Android.

Thank you for your help

2 Answers

Make a Raw Folder in xamarin.android and add you json file that have you Theme then write this code and its work. NativeMap.SetMapStyle(MapStyleOptions.LoadRawResourceStyle(this.Context, Resource.Raw.map_style_night));

Anyone else can help ? Is there any hacks we can do to get Dark Mode map in Google Maps without using Xamarin.Forms.GoogleMaps as this package seems to not work with the new versions on Xamarin ?

Related