React native firebase push notifications using expo permission - firebase

Can anyone help me to resolve this warning?
I am trying to send push notification using expo in React native.
I also tried to change permission from Notification to Permission but no luck.
warning when trying to access device token for send notification

Are you doing the managed flow or bare workflows?
I didn't get this exact message, but I got many that are similar. (I'm using a Managed flow). Likely culprit is a gap in your Firebase Cloud Messaging setup.
Be sure to review all the instructions expo here: https://docs.expo.dev/push-notifications/using-fcm/
I also added a response to an existing SO documenting some of my stumbling blocks which may be affecting you as well. That is here: Exception occurred while executing exported method getDevicePushTokenAsync on module ExpoPushTokenManager

Related

Error when trying to get expo notification token (Not valid firebase project ID)

I'm trying to use expo notification service to create push notifications in my app. I followed the setup guide in the official docs: https://docs.expo.dev/push-notifications/push-notifications-setup/
However I'm getting the following error instead of getting the device token:
[Unhandled promise rejection: Error: Fetching the token failed: Please set your Project ID. A valid Firebase Project ID is required to communicate with Firebase server APIs: It identifies your application with Firebase.Please refer to https://firebase.google.com/support/privacy/init-options.] at node_modules/react-native/Libraries/BatchedBridge/NativeModules.js:106:59 in promiseMethodWrapper at node_modules/expo-modules-core/build/NativeModulesProxy.native.js:15:45 in moduleName.methodInfo.name at node_modules/expo-notifications/build/getDevicePushTokenAsync.js:15:69 in getDevicePushTokenAsync at node_modules/expo-notifications/build/getDevicePushTokenAsync.js:4:53 in getDevicePushTokenAsync at node_modules/expo-notifications/build/getExpoPushTokenAsync.js:9:85 in getExpoPushTokenAsync at node_modules/expo-notifications/build/getExpoPushTokenAsync.js:8:51 in getExpoPushTokenAsync
Environment info:
I'm using expo managed workflow. Expo on version 45.0.0.
`
It feels like I should configure my firebase project but I'm still running it on expo go and according to docs, I should only need to do that on build phase. I tried it anyway, but had no success. Also tried reading the provided link on the error and tried to change my firebase init options, but I'm not sure if I did it right.

Can't create Firebase Cloud Messages From Console

For some reason, I don't see the ability for me to create FCMs from the Firebase console. It's not a browser issue as I tried on multiple browsers. It's not a permissions issue either since I am the owner of the project.
I tried implementing cloud functions to send FCMs and ever since when I go into the Cloud Messaging panel of the Firebase console I can no longer see the option to create messages.
Any insight would help!
Update--This is the error I'm getting from the JavaScript console:

Can FCM push notifications in Electron App

I'm trying to send notifications from Firebase Cloud Messaging (FCM) to a window app (window form for example) but it doesn't seem to be possible (since fcm only supports android/ios/webapp, for here and here).
So trying building Electron app to be able to receive and display notifications from fcm (slack is built from electron js and also displays notifications, here), and found the electron-push-receiver allowing it to receive notifications from FCM
But it seems that there is no update for a long time, so there is a issue#80
Now is it possible to build electron application that can receive notifications from FCM?
Thank you very much!
I just implemented FCM in my Electron app earlier today by following the guide here:
https://github.com/CydeSwype/electron-fcm-demo
Screenshot of FCM working in an Electron app
I was skeptical at first as well, given that the repo hasn't been updated in a while, but was pleasantly surprised that it still works.
If you have any further questions, go ahead and I'll try to help :)
I also got this working with electron-push-receiver, though I had to do a workaround for more recent versions of Electron.
I looked at the firebase-admin.messaging Node package but that is only for privileged environments.
The HTTP 503 issue you linked it seems was just another outage that has been resolved; I can still register for push notifications with this setup.

Unable to call Firebase function from React.js application

I have a React.js application powered by a number of Firebase functions and real time database standing behind them. It has been working without any issue for the past 2-3 months and now I am getting a warning on the functions logs which says that:
#firebase/database: FIREBASE WARNING: {"code":"app/invalid-credential","message":"Credential implementation provided to initializeApp() via the \"credential\" property failed to fetch a valid Google OAuth2 access token with the following error: \"Failed to parse access token response: Error: Server responded with status 404.\"."}
The way I initialize firebase from my React.js application looks like this:
I have double-checked everything standing behind process.env and it seems to be as expected. The website written in React.js in hosted under the Firebase hosting.
And this is how Firebase functions connect to Admin SDK:
I am not sure what would be the issue here. Nothing has changes in the code base from our side. Not sure if Firebase changed something internally that we need to consider.
What solved the issue for me was to go to the google cloud console (where Firebase functions are also available). Then I opened one of the failing cloud functions and I navigated to
My_Function_Name/Edit/RUNTIME, BUILD AND CONNECTIONS SETTINGS/RUNTIME SERVICE ACCOUNT/
And then I noticed there that for all of my functions it was selected App Engine Default Service Account instead of Firebase Admin SDK. I never explicitly set the runtime to this option. So, when I brought it back to Firebase Admin SDK the error was gone I was able to use the application once again.

Sending a notification crashes app

I have a react-native app, and I thoroughly followed all the steps mentioned here to add Firebase to your app, and Add the SDK.
However, when I try to send my first notification using the Notification composer, my application simply crashes with the message "pushNotif has stopped working". This happenes regardless of background or foreground state.
Has anyone ever experienced this? does anyone have any idea what could be wrong?
You should try react-native-fcm to implement FCM in react-native, then you'll be able to handle notifications in your react-native javascript code.

Resources