iOS版 - 最佳实践派的VoIP应用程序来电通知 [英] iOS - best practice to send incoming call notifications on VoIP app

查看:1759
本文介绍了iOS版 - 最佳实践派的VoIP应用程序来电通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我能想到的来电通知的第一个解决方案是苹果的推送通知服务。但是,它不能保证..有一个比较高的机会,它可能会丢失..并在VoIP应用程序,来电通知是如此的重要,我不能错过它往往...

The first solution I can think of for the incoming call notification is Apple's Push Notification service. However, it is not guaranteed.. there's a relatively high chance it may get lost.. and in a VoIP app, the incoming call notification is so important that I can't afford to miss it too often...

于是,我跟着<一个href=\"https://developer.apple.com/library/ios/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/AdvancedAppTricks/AdvancedAppTricks.html\">tips并启用后台模式,以保持应用程序活着,听任何来电邀请。通过正确的,我应该只显示本地通知时,应用程序获取来电邀请。此工程pretty以及当应用程序在后台/无效。但是,当用户手动杀死应用程序,没有code将得到执行,因此应用程序不会得到任何来电在这样的条件邀请...而且因为这种特殊情况下,我还是要依赖远程推送通知。

Thus, I followed the tips and enabled the Background Mode to keep the app alive and listening to any incoming call invite. By right, I should just show local notification when the app gets the incoming call invite. This works pretty well when the app is in background/inactive. HOWEVER, when user kills the app manually, no code will get executed, so the app won't get any incoming call invite in such a condition... And because of this particular scenario, I still have to rely on remote push notification.

我试图做到的,是..等待远程通知首先,如果它到达,那么不显示本地通知了。如果它丢失了,然后显示让用户总是会得到通知本地通知。

What I'm trying to achieve is.. waiting for remote notification first, if it arrives, then do not show local notification anymore. If it's lost, then show local notification so that user will always get notified.

问题是...我没有办法判断一个远程通知已经到来。

The problem is... I have no way to tell if a remote notification has arrived.

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

I want to know what is the best practice to handle incoming call notifications for a VoIP app?

推荐答案

从appleDoc <一个href=\"https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIApplication_Class/index.html#//apple_ref/occ/instm/UIApplication/setKeepAliveTimeout:handler:\"相对=nofollow>这里

From appleDoc here

在iOS 8的,后来,声音在IP(VoIP)的应用程序注册UIRemoteNotificationTypeVoIP推送通知,而不是使用此方法。使用推送通知省去了一个超时处理程序与VoIP服务办理入住手续。相反,当一个呼叫到达该用户,VoIP业务发送的VoIP推送通知到用户的设备。在收到该通知后,该装置发射,或根据需要,以便它可以处理来电唤醒应用程序。

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.

这篇关于iOS版 - 最佳实践派的VoIP应用程序来电通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆