在给定时间删除应用程序徽章
我的应用程序使用徽章来计算当天吸烟的数量。我希望应用程序在新的一天开始时的午夜删除徽章...可以这样做吗?
我的意思是,在应用程序关闭时执行此操作!
谢谢
My app uses badge to count the number of smoked cigarettes in the current day. I would like the app to remove the badge at the midnight, when a new day begins... Is it possible to do that?
I mean, doing that while the app is closed!
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
有趣的问题。我认为没有一种优雅的方式来处理这个问题;即使是多任务处理也无法唤醒应用程序来执行任务。您唯一可以做的就是安排本地通知,但这仅允许增加徽章编号 - 发送徽章编号“0”表示“无更改”。
抱歉,没有更好的答案。
安德鲁
Interesting question. I don't think there is an elegant way to handle this; even multi-tasking falls short of being able to wake the app to perform a task. The only thing you're allowed to do is schedule a Local Notification, but this is only allowed to increase the badge number - sending a badge number of "0" indicates "no change".
Sorry there isn't a better answer.
andrew
难道您不能在应用程序启动时检查它当天是否已启动,如果没有,请删除徽章吗?
Couldn't you just check, on application startup, if it was already started that day, and if not, remove the badge?