简体   繁体   中英

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).

1) Is this how APNS works, or is it a specific shortcoming of ionic, or am I doing something wrong? 2) If I'm not doing anything wrong, presumably the solution is to manually set the badge count locally in the onNotification callback. 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)
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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