React Native + FCM Topic Notifications - firebase-cloud-messaging

I'm facing a really random error that I cannot debug, for the life of me. I've tried everything, so I'm really hoping someone here can help.
I've created a React native app for iOS and Android, and I'm using FCM for data messages and notifications.
Specifically, I'm using topics to send notifications.
Here's the weird part:
It works sometimes and sometimes it doesn't. This is across different users and different topics. I will get a notification for a topic I've subscribed to one day and the next day, I won't get a notification sent to the same topic.
Some users will get a notification and some users don't. And they are all subscribed to the same topic.
There are no error messages. I assume this is something to do with FCM? I am at a loss on how to debug since it's so random.
Any suggestions?

Related

Use Firebase cloud messaging or let the app asks for event and fire notification with an API?

We are developing an app for Android and IOS for students. student can receive notification for upcoming events like exams or interviews.
We are between two decisions: Using FCM with the development of a backed which manages the sending of notifications and the registration of tokens or using the schedulers that exist in IOS and Android then download a list of events from an API regularly and trigger a local notification which will require less development on the backend side but a little more on the frontend side.
What would be best in your opinion and can we trigger a notification even if the app is closed for the 2nd solution?
I would deffinitely recommend to use FCM. It is much easier than it looks like and the performance of your notifications would be much better regarding stability, timing, battery persistance and other. You can use on of the Firebase databases to store the notification tokens and the Firebase Cloud Functions to send them from there. I have made a very similar App for Kindergarden children and it works great. I'm not sure if it would even work at all when you do it on your own. At least not as you expect it. For me that sounds like much more work.

Assigning webhooks to Firebase Messaging "subscribe to topic" event

In my current project I am using the Kreait Firebase PHP SDK to send out push notifications to Android & iOS devices that have subscribed to notifications on named topics. No issues thus far. However, rather than have fixed topic names I would now like to generate topic names based on the current "condition" of the connecting device. The condition could, for example, be a geographic location.
This is not too difficult either and I have modified my app to handle this. However, in order to put the ability to have such autogenerated topics to use I need to know the topic names on my server so I can send out targeted messages via Kreait. I find Google's Firebase documentation a bit dense at times and have not been able to establish whether it is possible to assign webhooks that get called by Firebase whenever a SubscribeToTopic, UnsubscribeFromTopic event occurs.
A simple question - does FCM even offer anything like this capability? If so, any pointers to the relevant documentation would be much appreciated.
There is no public API to get a list of topic names from Firebase, nor is there a way to hook into the subscription mechanism.
Your best bet is to simply make two calls when a user subscribes to a topic: one to Firebase, and one to your own backend API that keeps a list of active topics/conditions.

Push notifications not getting grouped (like Whatsapp)

I am using FCM Cloud Messaging framework to send and receive push messages for both Android and ios. To send messages from my server I call FCM v1 API. I use FCM SDK app in my native app (react native based) to generate device registration token, etc.
I am trying to find ways where the push messages show grouped in device system tray like on Whatsapp i.e. messages containing a particular unique id should be grouped under one category e.g. all messages for a particular stock ticker showing under one group, etc.
When searching for possible solutions I came across various links such as:
React Native - Android - FCM - Display group notification like What's app also allowing multiple grouped notifications
Group fcm notifications like whatsapp but allowing multiple group notifications
But none of those helped. For example sending "tag" field replaces previous message when new one is received with the same value. Moreover when app is closed none of the message handling functions of native app are executing on the device so I believe this should be purely a server side functionality. On FCM docs page there is no reference to grouping of messages.
https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages
Any suggestions on how to implement this ?
I implemented that with the help of the library react-native-push-notification and this issue helped me a lot Group notifications

How can I watch for API data updates in react native such as new message received in a messaging app?

I am trying to build a messaging app with react native and I don't want to use pre-built messaging components such as gifted-chat because what I want is to learn how to code such mechanisms.
Posting data is simple. I can just call my RESTful API whenever the "Send" button is pressed.
But then I would like messages sent by the other person to appear at the bottom of the conversation so that it looks like real time messaging. But how can I listen for new messages sent by the other person? Asking the API every 'n' seconds doesn't seem like a good idea.
As Dan suggested use sockets, there are plenty of tutorials that can show you how to implement real-time messaging in node.js with socketio. Here is my favorite! A quick google search returns plenty more of varying degrees of simplicity.
If you don't want to build your own backend then you can try Firebase. You will find some tutorials on google about how to implement a chat app.

Issues with the Sample Sample-chatv2-android and XMPP chat server

I was able to get Sample-chat version 2 android sample to run. The one-on-one chat function in the app works fine but the chatroom functionality does not work most of the time.
Since the chatroom functionality works sometimes the code seems to be fine. By debugging I was saw that the chatroom messages are not received from the XMPP server. When a chatroom is joined then sometimes the joining seems to be not successful and the older, saved messages in the chatroom are not received.
SO it seems like this is an isssue with the Quickblox XMPP chat server, since the sample app seems to work half of the time. Please let me know if the chatroom functionality is QuickBlox works properly. Thanks.
Thank you for your question in regards sample 2.
Unfortunately some bugs are possible in this sample.
We are creating new sample for Android chat, so soon we will share it.
Try to use new SDK and chat sample. It was recently released and contains several improvements.