我已经创建了一个离子应用程序。该应用程序收到通知并运行良好。但是,当我向应用程序发送更多通知时,它会叠加在通知栏(Android)中。
我想将多个通知合并为一个类似whatsapp的通知。实施例
从App
收到的2封邮件这是我的代码
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)
}
);
});
从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"
}
}