当应用程序未打开时收到推送通知时更新徽章编号 [英] Update Badge Number when push notification is received when App is not Open

查看:22
本文介绍了当应用程序未打开时收到推送通知时更新徽章编号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个应用程序,其中我面临的问题是徽章编号仅在我打开通知时更新,但即使应用程序未打开,我也需要更新徽章编号.

I have an App in which i am facing the issue that the badge number only gets updated when i open the notification but i need to update the badge number even when app is not open.

有人可以帮我吗??

推荐答案

您需要为推送通知负载中的 badge 键设置一个值.从您的描述来看,似乎只有您的应用程序在更新徽章编号,而不是通知本身.

You need to set a value for the badge key in your push notification payload. From your description, it sounds like it is only your application which is updating the badge number, and not the notification itself.

参见 Notification Payload 本地和推送通知编程指南详情:

See The Notification Payload of the Local and Push Notification Programming Guide for details:

aps 字典的键和值

badge(编号):显示为应用程序图标徽章的编号.如果此属性不存在,则不会更改徽章.要移除徽章,请将此属性的值设置为 0.

badge (number): The number to display as the badge of the application icon. If this property is absent, the badge is not changed. To remove the badge, set the value of this property to 0.

这篇关于当应用程序未打开时收到推送通知时更新徽章编号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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