APNS 向设备频繁发送通知

发布于 2024-10-11 03:11:11 字数 270 浏览 3 评论 0原文

我试图用我的应用程序模仿寻呼机,向用户发送推送通知,直到他或她做出响应。我的想法是每隔几秒发送一次推送并在到达时播放默认声音。并不完美,但总比没有好。

一切正常。然而,我发现在发送一些通知后,声音开始有点断断续续/中断——就好像它试图多次播放声音一样。即使我每 10 秒才发送一次推送,也会发生这种情况。我只是以 20 秒的间隔进行了测试,但即使这样,大约 10 次后声音也开始中断。

知道如何解决这个问题,以便每条消息都能清晰地播放声音吗?

ps 测试在 iPad 上进行。

I'm trying to mimic a pager with my app by sending push notifications to the user until he or she responds. My thought was to send a push every few seconds and play the default sound on arrival. Not perfect, but better than nothing.

It's working all right. However, I am finding that the sound starts to stutter/interrupt a bit after a few notifications have been sent -- as if it's trying to play the sound more than once. This happens even if I only send the push every 10 seconds. I just tested it at 20 second intervals and even then it starts to sound interrupted after about 10 times.

Any idea how to resolve this so each message plays the sound crisply?

p.s. Testing performed on an iPad.

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

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

发布评论

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

评论(2

孤独患者 2024-10-18 03:11:11

这是一个答案,从某种意义上说,我建议您不要这样做。我非常确定每隔几秒发送一次推送通知直到用户响应违反了 Apple 推送通知指南的第 2 部分(这是 Apple 开发者协议的附录 A)。您可能不会在这里找到满意的答案,原因有两个:

  1. 以前没有人这样做过,因为它可能违反了开发者协议
  2. Apple 不保证推送通知的顺序或传递,并且传递的速度取决于设备的网络和连接速度。

This is an answer, in the sense I'm going to advise you don't do this. I'm pretty sure sending push notifications every few seconds until the user responds violates section 2 of the Apple Push Notification guidelines (it's appendix A of you Apple developer agreement). You probably won't find a satisfactory answer here for two reasons:

  1. Nobody will have done it before, because it probably breaks the developer agreement
  2. Apple don't guarantee order or delivery of push notifications, and the speed at which they are delivered depends upon the device's network and connection speed.
扛起拖把扫天下 2024-10-18 03:11:11

我成功了。事实证明,在我尝试按照 Apple 的指南保持连接打开时,我错误地重用了我的 MemoryStream 对象。

重试间隔将由用户定义,因此我希望这不会违反苹果的任何规则。

感谢您的投入!

I got it working. Turns out in my attempt to keep the connection open per Apple's guideline I was mistakenly reusing my MemoryStream object.

The retry interval will be user definable so I hope this won't break any of Apple's rules.

Thanks for your input!

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