I have created an application in ionic. The application receives notification and is working well. However, when i send more notification to the application, it stacks up in the notification bar (Android).
I want to merge multiple notifications into one like whatsapp. Example
2 messages received from App
Here is my Code
app.component.ts
this.platform.ready().then(() => {
// Okay, so the platform is ready and our plugins are available.
// Here you can do any higher level native things you might need.
this.statusBar.styleDefault();
this.splashScreen.hide();
this.fcm.getToken()
.then((token: string) => {
console.log("The token to use is: ", token);
})
.catch(error => {
console.error(error);
});
this.fcm.onTokenRefresh().subscribe(
(token: string) => console.log("Nuevo token", token),
error => console.error(error)
);
this.fcm.onNotification().subscribe(
(data: NotificationData) => {
if (data.wasTapped) {
console.log("Received in background", JSON.stringify(data))
} else {
console.log("Received in foreground", JSON.stringify(data))
}
}, error => {
console.error("Error in notification", error)
}
);
});
Sending notification from PostMan
{
"to": "ej-t7zm9yHw:APA91bFzLdt0DO7tHMMoANUxDHADZ65dd0ZQaBQZxjKOap6npsZkuG22t-xQDE7adRyTsp8qDpxExzXnLXO4DB5vAr4RY7_jQSdITx8K2JmwqVnxLOLawua5KAwfQcMfi_d xxxxxxxx",
"notification": { "title": "testing stack notification ", "body":"is it working", "sound":"default", "icon":"icon",
"android": {
"data": {
"title": "testing stack notification",
"body": "is it working",
"style": "inbox",
"summaryText": "yes its %n% notifications",
"noteId": "123456"
}
}
},
"data":{
"content":"Please Check Report"
}
}