推送通知徽章自动增量 [英] Push-Notification Badge auto increment

查看:108
本文介绍了推送通知徽章自动增量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在为我的应用程序实现推送服务,我一直在考虑应用程序的徽章。我的应用程序是一个邮件应用程序(sorta),我想通过推送通知用户添加到收件箱中的新邮件,我想要徽章=收件箱中新邮件的数量。

I've been implementing the push service to my application, and I've been thinking about the application's badge. My app is a mail app (sorta) and I want to notify the user via push for new messages added to the inbox, I want the badge = number of new messages in the inbox.

我想做服务器端(提供商)检查新邮件并将号码作为徽章发送。

I thought of doing it server sided (provider) checking for new messages and sending the number as the badge.

问题是:
是有没有办法自动增加应用程序的徽章,而不必计算服务器侧的徽章值,然后将其作为推送有效负载的一部分发送到APSN?

The question is: Is there a way to auto-increment the application's badge, without having to calculate the badge value server sided and afterwards sending it as a part of the push payload to the APSN?

也许有一种方法可以在JSON徽章字段中发送一些变量,如++或类似的东西。
任何黑客攻击?或者我是否需要使用服务器端的计数系统??

Maybe there's a way to send in JSON badge field some variable like "++" or something like that. Any hack for that? Or do I need to go with the counting system server-sided??

推荐答案

不,你必须跟踪这个服务器端。如果您没有包含徽章的任何值,它将被完全删除。

Nope, you'll have to track this on the server side. If you don't include any value for badge, it will get removed completely.

当然,这只是在用户收到通知且应用不是正在运行/他们选择不启动它。如果用户启动应用程序或已经运行该应用程序,您可以执行任何有关增量的操作。

Of course though this is only if the user receives the notification and the app isn't running/they choose not to launch it. If the user launches the app or already had it running you can do whatever you want in regards to incrementing.

更新2014年3月:查看评论可能的更新。几年后我没有做过推动,所以我自己也无法验证。

UPDATE March 2014: See comments for a possible update. I haven't done pushes in several years so haven't been able to verify this myself.

这篇关于推送通知徽章自动增量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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