react-native-notifications icon indicating copy to clipboard operation
react-native-notifications copied to clipboard

Android App Crashes if Firebase isn't used

Open AbdullahADhaim opened this issue 7 years ago • 14 comments

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.

AbdullahADhaim avatar Jul 12 '19 08:07 AbdullahADhaim

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.

lodev09 avatar Jul 26 '19 11:07 lodev09

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

Also see the full installation guide

yogevbd avatar Jul 29 '19 12:07 yogevbd

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

jaska120 avatar Aug 01 '19 12:08 jaska120

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

yogevbd avatar Aug 01 '19 13:08 yogevbd

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.

jaska120 avatar Aug 02 '19 12:08 jaska120

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 avatar Aug 28 '19 04:08 sfreeman28

@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

HZSamir avatar Dec 17 '19 07:12 HZSamir

@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.

sfreeman28 avatar Dec 17 '19 18:12 sfreeman28

same issue + 1

lake2 avatar Apr 19 '20 14:04 lake2

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

rcstanciu avatar Jun 17 '20 12:06 rcstanciu

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

bhaskardabhi avatar Aug 04 '20 13:08 bhaskardabhi

Same issue here still React Native 0.64.3 react-native-notifications 4.2.4

rafakwolf avatar Mar 23 '22 01:03 rafakwolf

Same issue here still React Native 0.70.8 react-native-notifications 5.0.0

After 4 years...eh :(

peterbodo avatar Sep 12 '23 13:09 peterbodo

+1

chenweigh avatar Sep 19 '23 05:09 chenweigh