简体   繁体   English

在前台设置离子推送通知徽章计数

[英]setting ionic push notification badge count in foreground

Our push notifications sent from ionic's push API are not setting the badge count when the app is in the foreground (works just fine when backgrounded). 当应用程序在前台运行时,我们从ionic的push API发送的推送通知未设置徽章计数(在后台运行时效果很好)。

1) Is this how APNS works, or is it a specific shortcoming of ionic, or am I doing something wrong? 1)这是APNS的工作方式,还是离子的特定缺点,或者我做错了什么? 2) If I'm not doing anything wrong, presumably the solution is to manually set the badge count locally in the onNotification callback. 2)如果我没有做错任何事情,大概解决方法是在onNotification回调中手动设置徽章计数。 Does Ionic's client side push library support setting a badge count?* 请问离子的客户端推送库支持设置徽章算什么?*

I don't know who it's a limitation of, but I did get it to work by using the following config: 我不知道这是谁的限制,但是我确实通过使用以下配置使其起作用:

const push = new Ionic.Push({ ...settings, onNotification: function(n) {
    this._plugin.setApplicationIconBadgeNumber(() => null, () => null, n.count)
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM