CrossGeeks / AzurePushNotificationPlugin

Azure Push Notification Plugin for Xamarin iOS and Android
MIT License
67 stars 34 forks source link

Default FirebaseApp is not initialized exception #38

Closed michaldivis closed 4 years ago

michaldivis commented 4 years ago

I've followed the Getting Started tutorial and once I run my app, I get this exception on the line where this is: AzurePushNotificationManager.Initialize(this, AzureConstants.ListenConnectionString, AzureConstants.NotificationHubName, true);

The exception says this: Java.Lang.IllegalStateException: 'Default FirebaseApp is not initialized in this process com.company.xxx. Make sure to call FirebaseApp.initializeApp(Context) first.'

I've tried calling the FirebaseApp.initializeApp(this) first, it didn't help. I've also tried switching from debug to release configuration, also didn't help.

I'm using these nugets: Xamarin.Forms 4.4.0.991537 Plugin.AzurePushNotifications 2.0.23

My android app is targeting API 29 (Android Q).

gmbertolotto commented 4 years ago

You need to add Xamarin.Firebase.Messaging package to Android project

michaldivis commented 4 years ago

I'll give that a try, thank you.

michaldivis commented 4 years ago

So I've tried that and I'm still getting the same error. Any other ideas? Thanks

gmbertolotto commented 4 years ago

My Packages On my app in the Forms/Android project I have these packages installed and that error was gone

michaldivis commented 4 years ago

That's it! I installed the Xamarin.GooglePlayServices.Basement in my Xamarin.Forms Android project and the error has gone away. Thank you!

IeuanWalker commented 4 years ago

@Char0394 this should probably be added to the docs, or a dependency added to the NuGet. Adding the NuGet Xamarin.Firebase.Messaging to the android project and rebuilding fixed the issue.