在给定时间删除应用程序徽章

发布于 2024-09-15 18:25:10 字数 100 浏览 2 评论 0原文

我的应用程序使用徽章来计算当天吸烟的数量。我希望应用程序在新的一天开始时的午夜删除徽章...可以这样做吗?

我的意思是,在应用程序关闭时执行此操作!

谢谢

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

帅的被狗咬 2024-09-22 18:25:10

有趣的问题。我认为没有一种优雅的方式来处理这个问题;即使是多任务处理也无法唤醒应用程序来执行任务。您唯一可以做的就是安排本地通知,但这仅允许增加徽章编号 - 发送徽章编号“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

手心的温暖 2024-09-22 18:25:10

难道您不能在应用程序启动时检查它当天是否已启动,如果没有,请删除徽章吗?

Couldn't you just check, on application startup, if it was already started that day, and if not, remove the badge?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文