安排世博会通知并在一个小时后取消?

发布于 2025-01-25 00:20:14 字数 456 浏览 2 评论 0原文

通过博览会为自己构建(Android)应用程序,并反应本​​地。我想向用户(ME)发送计划的时间敏感通知。如果用户在一个小时后没有与通知进行交互,则无关紧要,因此我想取消通知,而无需用户需要将通知取消。我想安排许多此类自动通知。

  1. 看起来没有一种方法来“安排”取消。似乎我可以使用settimeoutcancelscheduledefificationasyanc在一个小时后取消它。有更好的方法吗?
  2. 即使settimeoutcancelschedulednotificationAsync适用于我计划的第一个通知,似乎我可能会在第二或第三次遇到麻烦。在settimeout中等待的时间很多。我担心如果设备用完电池或其他东西,一切都会弄乱。更好的想法?

感谢您的帮助! :)

Building an (Android) app for myself through Expo and React Native. I want to send scheduled time-sensitive notifications to the user (me). If the user hasn't interacted with a notification after an hour, it's irrelevant, so I would like to cancel the notification without the user needing to dismiss it. I would like to schedule many of these auto-dismiss notifications.

  1. Doesn't look like there's a way to "schedule" a cancellation. Seems like I could use setTimeout and cancelScheduledNotificationAsync to cancel it after an hour. Is there a better way?
  2. Even if setTimeout and cancelScheduledNotificationAsync works for the first notification I've scheduled, it seems like I could run into trouble with the second or third. That's a lot of time to be waiting in setTimeout. I'm worried about everything getting messed up if the device runs out of battery or something. Better ideas?

Thank you for your help! :)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文