1

I'm developing an app that can receive push notifications. In my nodejs serve sourcecode, I create a notification thanks to the 'firebase-admin' library. I use ionic/cordova-phonegap-plugin-push for the reception of said notifications.

I also managed to make the notifications stack themselves like Gmail notifications, or Discord notifications, etc... (ONE notification containing MULTIPLE notifications) using the 'style':'inbox' and 'summaryText' properties. Here is the message object I create in the backend nodejs server :

        const admin = require('firebase-admin');

        let message = {
            token: user.deviceId,
            data: {
                title: notification.title,
                body: status,
                style: 'inbox',
                summaryText: 'You have %n% new notifications',
                contentAvailable: 'true',
                type, // custom data I need
                targetId // custom data I need
            },
            android: { // android configuration
                priority
            },
            apns: {  // ios configuration
                headers: {
                    apnsPriority
                }
            }
        }
        console.log("message", message);
        admin.messaging().send(message)...

My first issue was that if the app is either killed or in the background, when you open it, with or without taping the stacked notifications, I only get the last notification received in the push.on('notification') phonegap event...

If there's a way to get ALL stacked notifications, I'm all ears, cause it don't seem like it's possible...

That's why I have another issue : as I can't get all notifications data, I would like to set a priority so that when I tap on the stacked notifications, I get the datas from the notification with the HIGHEST priority...

As you can see I've set priority variables for both Android and iOS but it doesn't seem to work... I'm only testing on Android right now.

I've asked my dear friend Google for the past 4hours without finding the answer... Is there a solution to this kind of issue ?

Thanks in advance for your help :)

Nicolas Ferrari
  • 61
  • 1
  • 11
  • I thing the push plugin might has some bugs some times , i want you if you can to give more detail or say yes or no on what i will ask you now. You are sending push notifications from firebase backend and want to recieve them in your app as inbox, or you are sending the notifications through firebase api and want to recieve them in app(since you said you are using push plugin and that is for triggering notifications and not mainly maid for recieving purpose) so please can you explain more or tell me what are you trying to do to give you the appropriate answer. – Mostafa Harb Jan 30 '20 at 14:29
  • Hello, thanks for your reponse. So, I use the firebase-admin plugin in the backend. Then the Android notification center (Firebase Cloud Messaging) receives the notification and wait for the application to be running to send it to my front-end. My issue is that I can't make FCM send all the notifications or just the one with the highest priority to the front-end... I hope I've been clear enough ^^ – Nicolas Ferrari Jan 30 '20 at 14:34
  • Ok i understood that you will send notification through the nodejs to firebase api, but the part that still not understood that what docyou mean by you wait the application to be running? Do you mean that you need to get the sent notifications from firebase and save them to app, like tour trying to make the same thing like gmail right? If yes tell me. – Mostafa Harb Jan 30 '20 at 14:40
  • Yes, I receive the notifications even if the app is not running, and when I tap on a notification, the app launches and the front-end gets the notification datas. The issue is that if there is multiple notifications, the front-end only gets datas of the last notification, and not the one with the property "priority" with the highest role. – Nicolas Ferrari Jan 30 '20 at 14:48
  • That is because the notifications are not saved in the firebase, if you realized: when firebase send the message , just a success messgae :true will be returned without a notificationId and that means that only one notification will be captured since the notifications of firebase if send from api will not be saved in your firebase console. I can't write here much and will take to to me to response and tou to response. If you want to get a sollutiin fast , you could whatsapp me on my number socwe can chat faster (my nb :0096176303389). – Mostafa Harb Jan 30 '20 at 14:52

0 Answers0