是否可以更新应用程序图标上的徽章编号,而无需在 iOS 的推送通知上打开应用程序? [英] Is it possible to update badge number on app icon without openining app on push notification in iOS?

查看:52
本文介绍了是否可以更新应用程序图标上的徽章编号,而无需在 iOS 的推送通知上打开应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

iOS 8 或 9

当我在 iOS 应用中收到推送通知时,我想在不打开应用的情况下更新应用图标上显示的徽章编号(以红色计数).

When I get push notification in my iOS app I want to update the badge number (count in red) shown on the app icon without opening the app.

目前它仅在应用程序打开后才会更新.

Currently it gets updated only and only once the app is opened.

这可能吗?

推荐答案

您需要为推送通知负载中的徽章键设置一个值.有效载荷通知

You need to set a value for the badge key in your push notification payload. Payload Notification

负载包含有关您希望如何通知用户的信息,例如使用警报、徽章或声音.它还可以包含您定义的自定义数据.

The payload contains information about how you want to notify the user, such as using an alert, badge or sound. It can also contain custom data that you define.

要移除徽章,请将此属性的值设置为 0.

To remove the badge, set the value of this property to 0.

这篇关于是否可以更新应用程序图标上的徽章编号,而无需在 iOS 的推送通知上打开应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆