React-native-notifications: Android App Crashes if Firebase isn't used

Created on 12 Jul 2019  路  11Comments  路  Source: wix/react-native-notifications

I'm getting this error message:
Default FirebaseApp is not initialized in this process com.app.app. Make sure to call FirebaseApp.initializeApp(Context) first

I'm Willing to use Local Notification in my apps and I don't want to add Firebase to y project.

Android acceptebug

Most helpful comment

Does anyone know if it's possible to use the latest version 2.0.6 without using Firebase for Android?

The docs say:

Note: This section is only necessary in case you wish to be able to receive push notifications in your React-Native app.

But it appears they might be outdated.

I really just want to use local notifications, with the ability to have an action button in the notification eg for media playback control. Thanks.

All 11 comments

If you don't plan to upgrade to android x yet, I suggest downgrading your RN Notifications to 1.1.23 (77f672cd3716dae8b91478f3fea2d1b24cd54838). This is the most recent GCM version of this package.

Fixed in 2.0.3. You can easily migrate using the instructions in our changelog file

Also see the full installation guide

I am still experiencing the same issue with 2.0.3 with the following output from logcat:

08-01 15:33:40.799 27901 27948 E AndroidRuntime: java.lang.IllegalStateException: Default FirebaseApp is not initialized in this process com.xxxxxxx.debug. Make sure to call FirebaseApp.initializeApp(Context) first.
08-01 15:33:40.799 27901 27948 E AndroidRuntime:    at com.google.firebase.FirebaseApp.getInstance(com.google.firebase:firebase-common@@16.0.1:219)
08-01 15:33:40.799 27901 27948 E AndroidRuntime:    at com.google.firebase.iid.FirebaseInstanceId.getInstance(Unknown Source:1)
08-01 15:33:40.799 27901 27948 E AndroidRuntime:    at com.wix.reactnativenotifications.gcm.FcmToken.refreshToken(FcmToken.java:73)
08-01 15:33:40.799 27901 27948 E AndroidRuntime:    at com.wix.reactnativenotifications.gcm.FcmToken.onAppReady(FcmToken.java:63)
08-01 15:33:40.799 27901 27948 E AndroidRuntime:    at com.wix.reactnativenotifications.gcm.FcmInstanceIdRefreshHandlerService.onHandleIntent(FcmInstanceIdRefreshHandlerService.java:23)
08-01 15:33:40.799 27901 27948 E AndroidRuntime:    at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:76)
08-01 15:33:40.799 27901 27948 E AndroidRuntime:    at android.os.Handler.dispatchMessage(Handler.java:106)
08-01 15:33:40.799 27901 27948 E AndroidRuntime:    at android.os.Looper.loop(Looper.java:193)
08-01 15:33:40.799 27901 27948 E AndroidRuntime:    at android.os.HandlerThread.run(HandlerThread.java:65)
08-01 15:33:40.800  1906  2619 W ActivityManager:   Force finishing activity com.xxxxxxx.debug/com.xxxxxxx.MainActivity

Have you followed the installation guide? It doesn't reproduce in our example project so you can use it as a reference

I did follow the installation guide and tried like the example project. However I am using react-native 0.60.4 and I think the example project is using 0.59.x. To overcome autolinking issue I put in my react-native.config.js as follows:

module.exports = {
  dependencies: {
    'react-native-notifications': {
      platforms: {
        android: null, // disable Android platform, other platforms will still autolink if provided
      },
    },
  },
};

The issue remains as described above.

Please also note that /example project in this repo has firebase as dependency.

Does anyone know if it's possible to use the latest version 2.0.6 without using Firebase for Android?

The docs say:

Note: This section is only necessary in case you wish to be able to receive push notifications in your React-Native app.

But it appears they might be outdated.

I really just want to use local notifications, with the ability to have an action button in the notification eg for media playback control. Thanks.

@sfreeman28 I'm in the same boat as you. Has there been any progress since on this?
@yogevbd Can we please reopen this issue? It's still outstanding

@sfreeman28 I'm in the same boat as you. Has there been any progress since on this?

I ended up using a different library for local notifications which did not require Firebase setup react-native-push-notification.
And for my media controls notification I used react-native-music-control.

same issue + 1

Still reproducing. Installing the library only for local notifications, without setting up Firebase, results in the following exception at startup:

06-17 15:17:41.937  9961 10054 E AndroidRuntime: java.lang.IllegalStateException: Default FirebaseApp is not initialized in this process com.nextfarm.app. Make sure to call FirebaseApp.initializeApp(Context) first.
06-17 15:17:41.937  9961 10054 E AndroidRuntime:    at com.google.firebase.FirebaseApp.getInstance(com.google.firebase:firebase-common@@16.0.2:240)
06-17 15:17:41.937  9961 10054 E AndroidRuntime:    at com.google.firebase.iid.FirebaseInstanceId.getInstance(Unknown Source:1)
06-17 15:17:41.937  9961 10054 E AndroidRuntime:    at com.wix.reactnativenotifications.fcm.FcmToken.refreshToken(FcmToken.java:78)
06-17 15:17:41.937  9961 10054 E AndroidRuntime:    at com.wix.reactnativenotifications.fcm.FcmToken.onAppReady(FcmToken.java:68)
06-17 15:17:41.937  9961 10054 E AndroidRuntime:    at com.wix.reactnativenotifications.fcm.FcmInstanceIdRefreshHandlerService.onHandleIntent(FcmInstanceIdRefreshHandlerService.java:23)
06-17 15:17:41.937  9961 10054 E AndroidRuntime:    at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:76)
06-17 15:17:41.937  9961 10054 E AndroidRuntime:    at android.os.Handler.dispatchMessage(Handler.java:106)
06-17 15:17:41.937  9961 10054 E AndroidRuntime:    at android.os.Looper.loop(Looper.java:214)
06-17 15:17:41.937  9961 10054 E AndroidRuntime:    at android.os.HandlerThread.run(HandlerThread.java:65)

React Native v0.62.2
react-native-notifications v3.2.2

Same issue happened to me. It crashed on first notification and then i am not receiving any notification. Firebase say it is sent but notifications aren't coming

Was this page helpful?
0 / 5 - 0 ratings