0

Via: https://firebase.google.com/docs/cloud-messaging/js/receive is it possible to send notifications to device tokens such that you might get via react-native app (it's still just js)..? ...So sending to Android app (react-native) vs a web app in the browser.

I currently have push notifications setup in the java layer but if it can all be done via js, albeit.

1 Answer 1

1

Firebase Cloud Messaging for the Web (FCM.js for short) depends on the browser's implementation of Web Push for the transport of messages.

A React Native app is very much not a browser-based app. So you cannot use FCM.js to receive message in your React Native app (unless somebody went out of their way to embed a compatible browser in the app).

Sign up to request clarification or add additional context in comments.

5 Comments

Super bummer! Not firebase's fault but a mobile application platform like react-native should have a push notification solution that doesn't require the dev to write a custom module, but nevertheless thanks for confirming my suspicions...
There is a third-party library in development binding many of the Firebase features from the native (iOS and Android) SDKs. See github.com/fullstackreact/react-native-firestack
Hmmm... This might be something that will be worth contributing to: github.com/fullstackreact/react-native-firestack/blob/master/…. Thanks for the link!
@FrankvanPuffelen there's a lot broken in firestack and the fcm implementation included in this - at least on ios, I was the author of the formerly upcoming v3 branch of firestack that aimed to standardise everything, but I eventually ended up creating github.com/invertase/react-native-firebase - it's well tested, updated frequently and any issues do get picked up quickly. There is a full FCM solution built in for android and ios with custom notification support.
"A React Native app is very much not a browser-based app. So you cannot use FCM.js to receive message in your React Native app (unless somebody went out of their way to embed a compatible browser in the app)." -> does this still apply?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.