设备锁定时的 iOS 推送通知操作

发布于 2024-12-14 03:30:23 字数 208 浏览 2 评论 0原文

我正在我的应用程序中处理推送通知。在推送通知警报中,我有“取消”和“加入”按钮。当应用程序在后台且未锁定时,警报会很好地显示,并带有取消和加入按钮。单击“加入”后,应用程序将向用户加入的 Web 服务器发送请求。这工作正常。

但是当手机锁定时,我看到的通知没有任何按钮。当用户解锁设备时,哪个操作将发送到应用程序:取消或加入?

发送“加入”但用户想取消的情况该如何处理?

I'm handling push notifications in my app. In the push notification alert, I've "Cancel" and "Join" buttons. When the app is in background and not locked, the alert shows well with cancel and join buttons. When join is clicked, app will send a request to web server that user joined. This is working fine.

But when the phone is locked, I'm seeing notification without any buttons. When user unlocks the device, which action will be sent to the app: cancel or join?

How should I handle the situation where "join" is sent but the user wants to cancel?

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

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

发布评论

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

评论(1

浴红衣 2024-12-21 03:30:23

您不能为推送通知指定多个操作。换句话说,如果用户点击“取消”按钮,操作系统甚至不会启动您的应用程序。同样,当用户通过滑动通知来解锁设备时,他们会隐式执行推送通知的操作按钮。

简而言之:除非用户调用通知的操作,否则您的应用程序永远不会启动。

问题是将单个操作解释为“加入”是否是一个好主意。 (我认为不是。您的应用程序应该要求确认。)

You cannot specify more than one action for a push notification. In other words, if the user taps the Cancel button, the OS will not even launch your app. Similarly, when the user unlocks the device by swiping over the notification, they implicitly execute the push notification's action button.

In short: your app is never launched unless the user invokes the notification's action.

The question is whether interpreting that single action as "Join" is a good idea. (I think it isn't. Your app should ask for confirmation.)

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