微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

iOS – 通过VoIP应用发送来电通知的最佳做法

可以想到的来电通知的第一个解决方案是苹果推送通知服务.然而,它不能保证..有一个相对较高的机会可能会丢失..在VoIP应用程序,来电通知是如此重要,我不能错过它太频繁…

因此,我按照tips,并启用了后台模式,使应用程序保持活动并收听任何来电邀请.通过权限,我应该在应用获得来电邀请时显示本地通知.当应用程序处于后台/非活动状态时,此功能很好.然而,当用户手动杀死应用程序时,没有代码将被执行,所以应用程序在这种情况下不会得到任何来电邀请…而且由于这种特殊情况,我仍然需要依靠远程推送通知.

我想要实现的是等待远程通知,如果它到达,那么不再显示本地通知了.如果丢失,则显示本地通知,以便用户始终得到通知.

问题是…我无法确定远程通知是否到达.

我想知道什么是处理VoIP应用程序的来电通知的最佳做法?

解决方法

来自appleDoc here

In iOS 8 and later,voice-over-IP (VoIP) apps register for UIRemoteNotificationTypeVoIP push notifications instead of using this method. Using push notifications eliminates the need for a timeout handler to check in with the VoIP service. Instead,when a calls arrives for the user,the VoIP service sends a VoIP push notification to the user’s device. Upon receiving this notification,the device launches or wakes the app as needed so that it can handle the incoming call.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐