APNS 向设备频繁发送通知
我试图用我的应用程序模仿寻呼机,向用户发送推送通知,直到他或她做出响应。我的想法是每隔几秒发送一次推送并在到达时播放默认声音。并不完美,但总比没有好。
一切正常。然而,我发现在发送一些通知后,声音开始有点断断续续/中断——就好像它试图多次播放声音一样。即使我每 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是一个答案,从某种意义上说,我建议您不要这样做。我非常确定每隔几秒发送一次推送通知直到用户响应违反了 Apple 推送通知指南的第 2 部分(这是 Apple 开发者协议的附录 A)。您可能不会在这里找到满意的答案,原因有两个:
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:
我成功了。事实证明,在我尝试按照 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!