This is a wrapper library around the native Android and iOS Firebase Xamarin SDKs. It includes cross-platform APIs for Firebase Analytics, Auth, Cloud Messaging, Dynamic Links, Firestore, Cloud Functions, Remote Config and Storage.
- Create a Firebase project in the Firebase Console, if you don't already have one. If you already have an existing Google project associated with your mobile app, click Import Google Project. Otherwise, click Create New Project.
- Click Add Firebase to your [iOS|Android] app and follow the setup steps. If you're importing an existing Google project, this may happen automatically and you can just download the config file.
[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.
- Add the following line of code to the place where your app gets bootstrapped:
CrossFirebase.Initialize(..., new CrossFirebaseSettings(...));
- Add the following
.csproj fileof your android project to prevent a build error (see this github comment for more information):
<PackageReference Include="Xamarin.Google.Guava.ListenableFuture" Version="184.108.40.206" ExcludeAssets="build;buildTransitive" />
- If you receive an error that states the
default Firebase App is not initialized, adding one package explicitly seems to resolve this issue (it doesn't seem to matter which package gets added).
Documentation and samples
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 Xamarin.Forms 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 Xamarin.Forms 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
google-services.json files of your own firebase project and adapt the other config files like
Info.plist, Entitlements.plist, AndroidManifest.xml.
Plugin.Firebase is released under the MIT license. See the LICENSE file for details.