iOS 远程通知处理

发布于 2024-11-08 01:40:04 字数 435 浏览 0 评论 0原文

简单的问题,我正在开发一个启用 APNS 的应用程序,我只想知道是否有一种方法可以在应用程序未打开(不在后台)并且应用程序收到远程通知时;

我可以在用户不知情的情况下在后台打开应用程序,并执行需要完成的操作。

我已经查看了文档,但没有明确说明可以或不能执行此操作(根据我读到的内容),它说用户必须手动打开应用程序(通过点击警报或应用程序图标)。

我认为我想要做什么很清楚,但我也会举一个例子。

示例)

默认的邮件应用程序会使用徽章图标提醒用户有新电子邮件,显示新电子邮件的数量以及声音。然后,用户必须点击应用程序图标才能打开应用程序并下载新电子邮件。

我希望能够拥有徽章和声音,但在后台(静默)打开应用程序并下载新电子邮件,这样当用户确实打开应用程序时,电子邮件就已经在那里,可以阅读了。

感谢您的任何帮助。

Quick question, I am working on an APNS enabled app and I just want to know if there is a way that when the app is not open (not in background) and the app receives a remote notification;

Can I open the app in the background, unbeknownst to the the user, and do do what needs to be done.

I have looked at the docs but it doesnt explicitly say that this can or cannot be done (from what I read), it says that the user has to open the app manually (either from tapping an alert or the app icon).

I think it is clear what I'm looking to do however i'll put an example aswell.

Example)

The default Mail app alerts the user of new emails with a badge icon, showing the number of new emails, aswell as a sound. The user must then tap the app icon to open the app and download the new emails.

I want to be able to have the badge and sound but open the app in the background (silently) and download the new emails, so that when the user does get around to opening the app the emails will already be there, ready to read.

Thanks for any help.

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

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

发布评论

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

评论(1

被你宠の有点坏 2024-11-15 01:40:04

不幸的是,你所描述的情况是不可能的。

获得类似功能的唯一方法是构建一个 voip 应用程序。请参阅本文档中的相关部分

实施 VoIP 应用程序
Internet 协议语音 (VoIP) 应用程序允许用户使用 Internet 连接而不是设备的蜂窝服务拨打电话。此类应用程序需要维护与其关联服务的持久网络连接,以便它可以接收传入呼叫和其他相关数据。该系统并没有让 VoIP 应用程序始终处于唤醒状态,而是允许它们暂停并为它们提供监控套接字的设施。当检测到传入流量时,系统会唤醒 VoIP 应用程序并将其套接字的控制权返回给它。

无论如何,我怀疑你的应用程序会进入应用程序商店,那么......

unfortunately, what you describe is not possible.

the only way you could get something like that is to build a voip app. see the relevant section in this document.

Implementing a VoIP Application
A Voice over Internet Protocol (VoIP) application allows the user to make phone calls using an Internet connection instead of the device’s cellular service. Such an application needs to maintain a persistent network connection to its associated service so that it can receive incoming calls and other relevant data. Rather than keep VoIP applications awake all the time, the system allows them to be suspended and provides facilities for monitoring their sockets for them. When incoming traffic is detected, the system wakes up the VoIP application and returns control of its sockets to it.

anyway, I doubt that your app would get into the App Store, then...

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