React-native-push-notification: Java.lang.IllegalStateException: Default FirebaseApp is not initialized in this process com.sutitaskmanager. Make sure to call FirebaseApp.initializeApp(Context) first.

Created on 16 Jul 2019  路  10Comments  路  Source: zo0r/react-native-push-notification

On Testing Notification Message From Google Firebase

java.lang.IllegalStateException: Default FirebaseApp is not initialized in this process com.sutitaskmanager. Make sure to call FirebaseApp.initializeApp(Context) first.
at com.google.firebase.FirebaseApp.getInstance(com.google.firebase:firebase-common@@16.1.0:245)
at com.google.firebase.messaging.MessagingAnalytics.zza(Unknown Source:68)
at com.google.firebase.messaging.MessagingAnalytics.logNotificationReceived(Unknown Source:2)
at com.google.firebase.messaging.FirebaseMessagingService.zzd(Unknown Source:50)
at com.google.firebase.iid.zzb.run(Unknown Source:2)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at com.google.android.gms.common.util.concurrent.zza.run(Unknown Source:6)
at java.lang.Thread.run(Thread.java:764)

Most helpful comment

try this

README
/**

  • (optional) default: true

    • Specified if permissions (ios) and token (android and ios) will requested or not,


    • if not, you must call PushNotificationsHandler.requestPermissions() later


    • if you are not using remote notification or do not have Firebase installed, use this:

  • requestPermissions: Platform.OS === 'ios'
    */
    requestPermissions: true,

All 10 comments

@zo0r I have Tested this a several time and got to know that this problem only occurs when app is open,

if it close the notification is working fine. but when the app is open it crashes as soon as the notification is received

Provide a solution for this

Im getting the exact same problem as @sourabhchotia.

React version: 16.8.6
React-native version: 0.60.3
React-native-push-notifications version: ^3.1.3

Java exception
2019-07-18 09:29:57.939 15118-15176/com.mcspoc E/AndroidRuntime: FATAL EXCEPTION: Firebase-FirebaseMessagingService Process: com.mcspoc, PID: 15118 java.lang.IllegalStateException: Default FirebaseApp is not initialized in this process com.mcspoc. Make sure to call FirebaseApp.initializeApp(Context) first. at com.google.firebase.FirebaseApp.getInstance(com.google.firebase:firebase-common@@17.1.0:186) at com.google.firebase.messaging.MessagingAnalytics.zza(com.google.firebase:firebase-messaging@@19.0.1:75) at com.google.firebase.messaging.MessagingAnalytics.logNotificationReceived(com.google.firebase:firebase-messaging@@19.0.1:2) at com.google.firebase.messaging.FirebaseMessagingService.zzc(com.google.firebase:firebase-messaging@@19.0.1:50) at com.google.firebase.messaging.zzg.run(com.google.firebase:firebase-messaging@@19.0.1:2) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) at com.google.android.gms.common.util.concurrent.zza.run(Unknown Source:6) at java.lang.Thread.run(Thread.java:764)

This issue occurred on both the emulator and a physical device
Physical device: Samsung Galaxy S8 running Android 8.0
Emulator: running Android 9.0

Would be great to see this fixed, as it's very possible to receive remote notifications while using the app in general.

Getting the same issue. App crashes on receiving a notification. Any update on this?

07-19 10:47:46.823 15914-16049/com.deeplinks E/AndroidRuntime: FATAL EXCEPTION: Firebase-RNPushNotificationListenerService Process: com.deeplinks, PID: 15914 java.lang.IllegalStateException: Default FirebaseApp is not initialized in this process com.deeplinks. Make sure to call FirebaseApp.initializeApp(Context) first. at com.google.firebase.FirebaseApp.getInstance(com.google.firebase:firebase-common@@17.1.0:186) at com.google.firebase.messaging.MessagingAnalytics.zza(com.google.firebase:firebase-messaging@@19.0.1:75) at com.google.firebase.messaging.MessagingAnalytics.logNotificationReceived(com.google.firebase:firebase-messaging@@19.0.1:2) at com.google.firebase.messaging.FirebaseMessagingService.zzc(com.google.firebase:firebase-messaging@@19.0.1:50) at com.google.firebase.messaging.zzg.run(com.google.firebase:firebase-messaging@@19.0.1:2) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) at com.google.android.gms.common.util.concurrent.zza.run(Unknown Source) at java.lang.Thread.run(Thread.java:818)

I can confirm the same issue.

After playing a bit with push notification payload, seems like having "notification": {"body": "message"} is causing v3.1.3 to crash with that error.

Removing notification.body ^ and having title and message attrs in the root of payload is working fine with v3.1.3, but is crashing v3.0.1 that we currently use, so that way we would break existing installs of the app in production.

Is anyone who resolved this problem? I face the same:

java.lang.IllegalStateException: Default FirebaseApp is not initialized in this process ua.vo_app_cabinet. Make sure to call FirebaseApp.initializeApp(Context) first.
at com.google.firebase.FirebaseApp.getInstance(com.google.firebase:firebase-common@@17.1.0:186)
at com.google.firebase.messaging.MessagingAnalytics.zza(com.google.firebase:firebase-messaging@@19.0.1:75)
at com.google.firebase.messaging.MessagingAnalytics.logNotificationReceived(com.google.firebase:firebase-messaging@@19.0.1:2)
at com.google.firebase.messaging.FirebaseMessagingService.zzc(com.google.firebase:firebase-messaging@@19.0.1:50)
at com.google.firebase.messaging.zzg.run(com.google.firebase:firebase-messaging@@19.0.1:2)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
at com.google.android.gms.common.util.concurrent.zza.run(Unknown Source)
at java.lang.Thread.run(Thread.java:760)

Try removing the GCM config from the manifest if you are using Firebase. Hope it helps.


android:name="com.google.android.gms.gcm.GcmReceiver"
android:exported="true"
android:permission="com.google.android.c2dm.permission.SEND" >





GcmReceiver

Thank you for immediate answer, but nothing changed.
In my project I can not find any code where Firebase App is mentioned. Maybe I did not add something?

Same error . Somebody please help

Same error . Somebody please help

This solution helped for me https://github.com/wix/react-native-notifications/issues/285#issuecomment-459178520

try this

README
/**

  • (optional) default: true

    • Specified if permissions (ios) and token (android and ios) will requested or not,


    • if not, you must call PushNotificationsHandler.requestPermissions() later


    • if you are not using remote notification or do not have Firebase installed, use this:

  • requestPermissions: Platform.OS === 'ios'
    */
    requestPermissions: true,
Was this page helpful?
0 / 5 - 0 ratings