How to stack/group multiple fcm notification in status bar in android - push-notification

how to group/stack multiple notification in status bar if fcm server send multiple notification to application or user at app side doesnot read previous notification.And how to handle pending intent for each notification.

Related

How can I find out about notification delivery (ti.goosh)

I use Appcelerator Titanium and I have module ti.goosh for push notification. How can I find out about notification delivery? In 'callback' I can find out about opening the notification, but I want to also know that the notification is in the device tray (for example using console.log).
I depends on what kind of message you are sending. A FCM data message is handled by the module with the NotificationCompat.Builder but if you are sending a normal FCM notification message the system is creating the notification and displaying it. You will only know if the notification was clicked by the user (like you already do) or if it arrived while the app was in foreground.

How to fix Firebase notification issue while in background mode

When my Ionic app is in foreground, notification arrives perfectly.
When my Ionic app is in background, the Firebase push notification displays the a system tray notification. Pressing the banner opens the app and the notification fires. I am completely fine with that.
But, if user decides to open the app without clicking the banner, the notification doesn't trigger. Anytime clicking the banner results into the arrival of the notification into the app.
How can I resolve this situation? How can I make the notification fire, regardless of whether the app is clicked from notification tray or normally?
Edit:
The firebase data message I'm sending looks like this :
{
"data":{
"fieldA":"A",
"fieldB" : "B",
"fieldC" : "C",
"total" : 1234,
"title" : "_my_title",
"message" : "_my_message",
"sound" : "default",
"cick_action": "FCM_PLUGIN_ACTIVITY"
},
"to":"/topics/MY_TOPIC",
"priority":"high"
}
Make sure the notification you send is of type data message, not display messages.
With FCM, you can send two types of messages to clients:
Notification messages, sometimes thought of as "display messages."
These are handled by the FCM SDK automatically.
Data messages, which
are handled by the client app.
https://firebase.google.com/docs/cloud-messaging/concept-options
Also
When in the background, apps receive the notification payload in the
notification tray, and only handle the data payload when the user taps
on the notification. When in the foreground, your app receives a
message object with both payloads available.
And
To receive messages, use a service that extends
FirebaseMessagingService. Your service should override the
onMessageReceived and onDeletedMessages callbacks.
https://firebase.google.com/docs/cloud-messaging/android/receive

inbox stacking in phonegap-plugin-push

I am using Phonegap-plugin-push for receiving notifications in ionic app and I have done inbox-stacking. How will I identify if a notification contains n collapsible notifications or single notification. Currently, if I select collapsed notification, the action for last notification is getting executed.

How can I clear firebase cloud message notifications?

I use firebase cloud message to send messages to my phone, and I can successfully receive notifications. But in some cases, I do not click notifications to open my app, but manually open the app to go into foregroud. And what I want is when I open the app, notifications in notification bar should be automatically cleared.
The following code will clear all notifications for your app, including those created by FCM. You could add this to the onResume method of your main activity:
NotificationManager manager = (NotificationManager) getApplicationContext()
.getSystemService(Context.NOTIFICATION_SERVICE);
manager.cancelAll();
Usually you would cancel a notification by specifying the ID you gave it when it was created, however as FCM is creating the notification for you, you can't know its ID, and so must cancel it by cancelling all notifications as above.

Regarding Push Notification In Worklight?

Push Notification had been executed and worked perfectly in my
application. (I made use of worklight push notification module IBM
LINK)
There was a scenario which i experienced during the
notification received in the application android device.
The push notification is received perfectly in all the situtaion except when i am in the Login Screen(When i am in the login screen of the application the push notification is not received in my application).
Question :
Why push notification is not received in the application ?
What is the client side (Device side) architecture/execution flow , by which i can
understand when is the PushNotification Receiver (Broad Cast
Receiver) in device is ready to receive the notification and when it
can't receive notifications ?
This is the expected behavior.
You've implemented event source-based pus notifications. In this type of push notifications you must first login in order to receive notification. This is why while you're at the login screen, you will not receive the notification.
If you are using either Worklight 6.2 or MobileFirst Platform 6.3, you can use tag or broadcast-based notifications which do not require a login.
You can read more about these at the IBM MobileFirst Platform developer center.
Here is a rundown of possible scenarios:
Application is closed - notification arrives to device - by opening the application / tapping the notification in the notification bar, you will get a login screen. After you login you will actually see the payload (in the way you choose to, that's purely applicative). You will not see the actual payload, because you don't want user B for example to see the payload of user A.
Application is opened - you are logged in, but the app is in the background - notification arrives to the device - by tapping the notification or bringing the application to the foreground, because you are already logged in, you'll see the payload
Application is opened - you are NOT logged in - notification arrives to the device - you will not be able to see the payload, because you are not logged in.
Application is opened - you are logged in, and the app is in the foreground - notification arrives to the device - you will immediately see the payload (per your applicative code)

Resources