Getting the error - undefined is not an object (evaluating FIRMessaging.initialData)
Any cues on getting this going?
FWIW, here's the repo. Any help appreciated! :) https://github.com/Cheapass/droid/commit/5a97e7b4c6e2ce6ecb37098d22168d723e8eefa3
Got it working! Never mind :)
@aakashipin What was your problem ? I am having the same issue when building on emulator, but not when doing an assembleRelease
@Tiagojdferreira in my case it was due to the presence of 2 conflicting adb versions (I had installed Genymotion at first and Android Studio later).
However, I encountered it again when integrating with https://github.com/alinz/react-native-share-extension
I had to do this to make it work then -
if (FIRMessaging) {
FCM.initialData = FIRMessaging.initialData;
FCM.initialAction = FIRMessaging.initialAction;
}
I don't have conflicting adb versions and I'm not using the share extension, but I do have this issue, FIRMessaging remains undefined in my app...
Any idea?
OK got it working, had to manually add new FIRMessagingPackage(), to my MainApplication.java (with import com.evollu.react.fcm.FIRMessagingPackage;)
Don't know why rnpm link didn't add this one...
I'm not able to import FIRMessagingPackage to my MainApplication.java
I got this error:
MainApplication.java:19: error: package com.evollu.react.fcm does not exist
import com.evollu.react.fcm.FIRMessagingPackage;
Can anyone help me?
@andfs I have the same problem. Let me know if you get any solution.
@devekoperiOS I've forgot to do this:
react-native link react-native-fcm
Its got linked. Now I am stuck at getting token.
So you're luckier than I. My app crashes and closes
I had the same issue when trying to use FCM from iOS share extension. I didn't find reason why FIRMessaging is undefined, but this is the fix which at least prevents the app/extension crash -
https://github.com/evollu/react-native-fcm/pull/86
@romanmandryk I'm not using IOS share extensions. My app crashes in android. But I'll try your solution and I'll give a feedback. I hope that you solution could resolve my problem too.
thank you so much @romanmandryk
Make sure you follow the full README. the link commands adds code to app/build.gradle, settings.gradle and MainApplication.java, and then you need to add extra lines manually to app/build.gradle, build.gradle, AndroidManifest.xml and google-services.json
@antoinerousseau , the link you've given is dead. Can you please check
@PoojaVM sorry that project is not public anymore. have a close look at the README you should be fine.
@antoinerousseau , I have followed all the steps from README and have made sure to try every solution provided for this particular issue. Still I get the same issue of FIRMessaging being undefined.
Anyway, thanks for letting me know.
Most helpful comment
OK got it working, had to manually add
new FIRMessagingPackage(),to myMainApplication.java(withimport com.evollu.react.fcm.FIRMessagingPackage;)Don't know why
rnpm linkdidn't add this one...