Onion.Maui.GoogleMaps 5.0.3

dotnet add package Onion.Maui.GoogleMaps --version 5.0.3
NuGet\Install-Package Onion.Maui.GoogleMaps -Version 5.0.3
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Onion.Maui.GoogleMaps" Version="5.0.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Onion.Maui.GoogleMaps --version 5.0.3
#r "nuget: Onion.Maui.GoogleMaps, 5.0.3"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Onion.Maui.GoogleMaps as a Cake Addin
#addin nuget:?package=Onion.Maui.GoogleMaps&version=5.0.3

// Install Onion.Maui.GoogleMaps as a Cake Tool
#tool nuget:?package=Onion.Maui.GoogleMaps&version=5.0.3

Logo Maui.GoogleMaps

NuGet alternate text is missing from this package README image

Maps library for MAUI that uses Google maps on both mobile platforms - Android and iOS.

Usage is almost the same as Xamarin.Forms.GoogleMaps - github because it was forked from it. More information about library capabilities can be found there. Please note that after the migration to MAUI some properties, events or commands may have been omitted. Also, the namespace is Maui.GoogleMaps instead of Xamarin.Forms.GoogleMaps.

Platform Support

Platform Supported
iOS Yes
Android Yes
Windows 10/11 No
Others No

Setup

  • Target .NET 8 for best experience
  • Install into your MAUI project by downloading the library from nuget: NuGet
  • Finish the Google Cloud Console setup
  • Get your API Keys from Google, then in Platforms/Android:
// MainApplication.cs
 [Application]
 [MetaData("com.google.android.maps.v2.API_KEY",
            Value = Variables.GOOGLE_MAPS_ANDROID_API_KEY)]
 public class MainApplication : MauiApplication
 {
    public MainApplication(IntPtr handle, JniHandleOwnership ownership) 
    : base(handle, ownership)
    { }
    
    protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
  }

And in the MauiProgram.cs file

// MauiProgram.cs
using Maui.GoogleMaps.Hosting;
...
public static MauiApp CreateMauiApp()
{
        var builder = MauiApp.CreateBuilder();
        builder.UseMauiApp<App>();
            
#if ANDROID
        builder.UseGoogleMaps();
#elif IOS
        builder.UseGoogleMaps(Variables.GOOGLE_MAPS_IOS_API_KEY);
#endif
        return builder.Build();	
}

Sample application is here.

Contribution

I really appreciate your contribution. If u have spotted a bug you want to fix or have a feature/enhancement you would like to implement please open a pull request targeting the maui branch. If u have any questions you are free to reach out to me - all contact info is available in my profile.

License

See LICENSE .

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-android34.0 is compatible.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-ios17.0 is compatible.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Onion.Maui.GoogleMaps:

Package Downloads
CHGX6.Maui.GoogleMaps.Bindings

MAP Behaviors library for MAUI that is optimized for Google maps.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
5.0.3 3,288 1/24/2024
5.0.2 622 1/11/2024
5.0.1 15,069 5/6/2023
5.0.0 14,573 11/16/2022
5.0.0-alpha1 377 7/5/2022

# 5.0.3
- Refactoring + optimized pin display on Android