![]() |
VOOZH | about |
dotnet add package Plugin.Firebase --version 4.2.1
NuGet\Install-Package Plugin.Firebase -Version 4.2.1
<PackageReference Include="Plugin.Firebase" Version="4.2.1" />
<PackageVersion Include="Plugin.Firebase" Version="4.2.1" />Directory.Packages.props
<PackageReference Include="Plugin.Firebase" />Project file
paket add Plugin.Firebase --version 4.2.1
#r "nuget: Plugin.Firebase, 4.2.1"
#:package Plugin.Firebase@4.2.1
#addin nuget:?package=Plugin.Firebase&version=4.2.1Install as a Cake Addin
#tool nuget:?package=Plugin.Firebase&version=4.2.1Install as a Cake Tool
This is a wrapper library around the native Android and iOS Firebase SDKs which includes cross-platform APIs for most of the Firebase features. Documentation and the included sample app are MAUI-centric, but the plugin should be usable in any cross-platform .NET9+ project.
() => Platform.CurrentActivity)The plugin remains compatible with these (and other) auth providers, but it is now the developers' responsibility to implement them by directly accessing the native SDKs per-platform.
For Google and Facebook, the existing v3 provider packages may or may not still work. If not, you may examine the source code of this project (< v4.0) to migrate the implementations into your own project. In either case, you should be aware that both of these provider implementations use deprecated native APIs and it is strongly recommended to migrate to modern native APIs.
For Apple, Android was never supported by this plugin, and platform code on the Apple side was just this method.
To properly use these providers (and others) with this plugin, the general approach is:
AuthCredential (Firebase.Auth.AuthCredential from Xamarin.Firebase.Auth (Android) or AdamE.Firebase.Auth(iOS)). This is the part that can differ wildly by platform / provider, and sometimes requires additional platform binding libraries which may or may not be available readily available on NuGet. Starting-point documentation for this is https://firebase.google.com/docs/authAuthCredential to the SignInWithCredential or LinkWithCredential methods of the native auth implementations (i.e., FirebaseAuth.DefaultInstance)Since Plugin.Firebase uses the same FirebaseAuth.DefaultInstance objects internally, it will autmoatically pick up on the auth state changes from the native SDKs.
View the v4.0 pull request for more information.
This plugin is a thin wrapper around the native Firebase binding packages, which are, in turn, wrappers around the native platform SDKs. As such, developers should not primarily rely on documentation in this plugin for Firebase project configuration or SDK usage. The official Firebase docs should be your primary Firebase resource.
[GoogleService-Info.plist|google-services.json] file to your app project.[GoogleService-Info.plist|google-services.json] build action behaviour to [Bundle Resource|GoogleServicesJson] by Right clicking/Build Action.The native Firebase SDKs for both Android and iOS have their own set of dependencies--some of which are shared by other common Google libraries. To maximize compatibility and give developers the flexibility to choose from a range of compatible native SDK versions, this plugin's NuGet configuration specifies version ranges for the native SDK binding libraries. When resolving dependencies, NuGet's standard behavior is to resolve minimum compatible versions. This ultimately means that developers are responsible for managing versions of the Firebase iOS/Android SDKs that are included in their projects. This is done by adding the appropriate AdamE.Firebase.iOS.* and Xamarin.Firebase.* NuGet package references to your project. This is not strictly required for the plugin to work, but it is recommended to ensure that you are using the latest versions of the Firebase SDKs, which may include bug fixes or performance improvements internal to the Firebase SDKs.
When new major versions of native SDKs are released, Plugin.Firebase may or may not be compatible with them. It depends on whether or not breaking API changes have been introduced. In such cases, please open an issue (or PR) and the plugin will be updated to support the new version.
The native binding packages are published using a versioning scheme [MAJOR].[MINOR].[PATCH].[REVISION]. The MAJOR, MINOR, and PATCH version numbers mirror the native Firebase SDK versions. The REVISION number is incremented if the bindings themselves are updated. (Note: On Android, a '1' is prefixed to the MAJOR version. For example, native Android SDK 24.1.0 is published as 124.1.0.)
When selecting package versions for iOS, best practice is to make sure that the MAJOR and MINOR versions match across all packages (e.g. 11.8..). Then, for each package, select the latest PATCH.REVISION.
When selecting package versions for Android, best practice is to choose a Firebase BoM and select matching package versions for each dependency. As examples, if you wish to use BoM version 33.8.0, then you would want to select Xamarin.Firebase.Analytics v122.2.0 and Xamarin.Firebase.Auth v123.1.0.
To get started add the GoogleService-Info.plist and the google-services.json files to the root folder of your project and include them in the .csproj file like this:
<ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">
<GoogleServicesJson Include="google-services.json" />
</ItemGroup>
<ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">
<BundleResource Include="GoogleService-Info.plist" />
</ItemGroup>
Initialize the plugin in your MauiProgram.cs like this:
using Plugin.Firebase.Auth;
#if IOS
using Plugin.Firebase.Core.Platforms.iOS;
#elif ANDROID
using Plugin.Firebase.Core.Platforms.Android;
#endif
public static class MauiProgram
{
public static MauiApp CreateMauiApp()
{
return MauiApp
.CreateBuilder()
.UseMauiApp<App>()
...
.RegisterFirebaseServices()
.Build();
}
private static MauiAppBuilder RegisterFirebaseServices(this MauiAppBuilder builder)
{
builder.ConfigureLifecycleEvents(events => {
#if IOS
events.AddiOS(iOS => iOS.WillFinishLaunching((_,__) => {
CrossFirebase.Initialize(new CrossFirebaseSettings());
return false;
}));
#elif ANDROID
events.AddAndroid(android => android.OnCreate((activity, _) =>
CrossFirebase.Initialize(activity, () => Platform.CurrentActivity, CreateFirebaseSettings())));
#endif
});
builder.Services.AddSingleton(_ => CrossFirebaseAuth.Current);
return builder;
}
}
Ensure the ApplicationId in your .csproj file matches the bundle_id and package_name inside of the [GoogleService-Info.plist|google-services.json] files:
<ApplicationId>com.example.myapp</ApplicationId>
The plugin doesn't support Windows or Mac catalyst, so either remove their targets from your .csproj file or use preprocessor directives and MSBuild conditions, e.g:
<ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios' OR Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">
<PackageReference Include="Plugin.Firebase" Version="4.0.0" />
</ItemGroup>
Take a look at the sample project to get more information.
In the docs folder you can find for every feature a designated readme file that describes the setup and usage of this feature or where to find more information.
In the sample folder you can find a sample MAUI project. This project serves as a base to play around with the plugin and to test features that are hard to test automatically (like Authentication or Cloud Messages). playground-functions is a Cloud Functions project and contains the code to enable sending Cloud Messages from the backend.
In the tests folder you can find a MAUI project that lets you run integration tests. You should definitely check out the *Fixture.cs files to learn how the plugin is supposed to work. All the tests should pass when they get executed on a real device.
In case you would like to run the sample or test project by yourself, you need to add the GoogleService-Info.plist and google-services.json files of your own firebase project and adapt the other config files like Info.plist, Entitlements.plist, AndroidManifest.xml.
@coop-tim has created a .NET 8 sample project with a really good and extensive description. It's targeting iOS and Android with Firebase Cloud Messaging, Analytics and the relevant build pipelines to get them built and pushed into App Center. Definitely worth checking it out!
If you would like to use the Firebase Local Emulator Suite for your tests or rapid prototyping you can do so by following the steps of the Getting started guide and calling the UseEmulator(host, port) method of the desired firebase service before doing any other operations.
For example the Plugin.Firebase.IntegrationTests project is configured to be able to use the Cloud Firestore emulator. You can start the emulator with initial seed data by running firebase emulators:start --only firestore --import=test-data/. Uncomment the line CrossFirebaseFirestore.Current.UseEmulator("localhost", 8080); in IntegrationTestAppDelegate.cs or MainActivity.cs to let the test project know it should use the emulator. Now all firestore related tests should pass.
Visual Studio and Windows both have issues with long paths. The issue is explained (along with best-known workarounds) here.
You are welcome to contribute to this project by creating a Pull Request. See CONTRIBUTING.md and BUILDING.md for contribution and build guidance. The project contains an .editorconfig file that handles the code formatting, so please apply the formatting rules by running dotnet format Plugin.Firebase.sln in the console before creating a Pull Request (see dotnet-format docs or this video for more information).
Plugin.Firebase is released under the MIT license. See the LICENSE file for details.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 net9.0 is compatible. net9.0-android net9.0-android was computed. net9.0-android35.0 net9.0-android35.0 is compatible. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-ios18.0 net9.0-ios18.0 is compatible. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
Showing the top 2 NuGet packages that depend on Plugin.Firebase:
| Package | Downloads |
|---|---|
|
SHARIZ.Infrastructure.Core
Package Description |
|
|
NeuroSpeech.NativeShell
Package Description |
Showing the top 1 popular GitHub repositories that depend on Plugin.Firebase:
| Repository | Stars |
|---|---|
|
simpleidserver/SimpleIdServer
OpenID, OAuth 2.0, SCIM2.0, UMA2.0, FAPI, CIBA & OPENBANKING Framework for ASP.NET Core
|
| Version | Downloads | Last Updated |
|---|---|---|
| 4.2.1 | 14,630 | 3/7/2026 |
| 4.1.0 | 949 | 3/1/2026 |
| 4.0.0 | 21,214 | 12/28/2025 |
| 3.1.4 | 86,581 | 3/28/2025 |
| 3.1.3 | 25,624 | 1/16/2025 |
| 3.1.2 | 14,659 | 12/3/2024 |
| 3.1.1 | 21,554 | 11/9/2024 |
| 3.0.0 | 50,089 | 5/29/2024 |
| 2.0.14 | 35,641 | 5/2/2024 |
| 2.0.13 | 18,384 | 3/29/2024 |
| 2.0.12 | 22,036 | 1/24/2024 |
| 2.0.11 | 2,642 | 1/13/2024 |
| 2.0.10 | 7,686 | 1/4/2024 |
| 2.0.9 | 5,735 | 11/22/2023 |
| 2.0.8 | 2,640 | 11/20/2023 |
| 2.0.7 | 1,484 | 11/14/2023 |
| 2.0.6 | 7,460 | 10/18/2023 |
| 2.0.5 | 16,619 | 7/28/2023 |
| 2.0.4 | 2,394 | 7/20/2023 |