OneSignal / OneSignal-Xamarin-SDK

OneSignal is a free push notification service for mobile apps. This plugin makes it easy to integrate your Xamarin app with OneSignal. https://onesignal.com
Other
105 stars 50 forks source link

[Bug]: [3.12.7] Issue with FirebaseApp not initialized on Samsung Galaxy s21 #346

Closed devperson closed 2 years ago

devperson commented 2 years ago

What happened?

I am getting the com.google.firebase.FirebaseApp.getInstance java.lang.IllegalStateException: Default FirebaseApp is not initialized in this process app.utilla. Make sure to call FirebaseApp.initializeApp(Context) first after a few seconds of the app launch, on my samsung galaxy s21 device. Here is the stacktrace:

com.google.firebase.FirebaseApp.getInstance FirebaseApp.java:183
com.google.firebase.messaging.MessagingAnalytics.logToScion com.google.firebase:firebase-messaging@@22.0.0:28
com.google.firebase.messaging.MessagingAnalytics.logNotificationReceived com.google.firebase:firebase-messaging@@22.0.0:2
com.google.firebase.messaging.FirebaseMessagingService.passMessageIntentToSdk com.google.firebase:firebase-messaging@@22.0.0:7
com.google.firebase.messaging.FirebaseMessagingService.handleMessageIntent com.google.firebase:firebase-messaging@@22.0.0:3
com.google.firebase.messaging.FirebaseMessagingService.handleIntent com.google.firebase:firebase-messaging@@22.0.0:3

It seems this happens in the logNotificationReceived method of the MessagingAnalytics. I found relevant post in the StackOverflow: https://stackoverflow.com/questions/52169115/android-firebase-crash-in-messaginganalytics

Steps to reproduce?

1) Launch app on Samsung galaxy s21 device
2) after a few seconds of using it crashes

What did you expect to happen?

app should work like on other devices without crash

OneSignal Android SDK version

Release 4.1.3

Android version

12

Specific Android models

Samsung Galaxy S21 5G with Android 12

Relevant log output

No response

Code of Conduct

jkasten2 commented 2 years ago

@devperson In order to use firebase-messaging 22 or higher you must use OneSignal-Android-SDK 4.4.0 or newer so I believe this is your issue. However we always recommend the latest version SDK.

After updating if you still see the issue please provide the updated error message and we an reopen this issue.

devperson commented 1 year ago

Hi @jkasten2, I am using the OneSignalSDK.Xamarin for Xamarin Forms so currently I am using the latest version(4.1.3) for XF. I fixed the issue by changing the notification body/content(json payload)

jkasten2 commented 1 year ago

@devperson Good to hear you got it working! Very odd that the payload change would have any effect on the "Default FirebaseApp is not initialized in this process app" error.

When you did have the error, was it causing a crash or just you noticed it in the logcat?

devperson commented 1 year ago

Yes the app crashes. I got the StackTrace of the error from AppCenter