問(wèn)題描述
我是 ios 新手.我想知道是否有任何方法可以檢測(cè)來(lái)電、去電等呼叫事件,即使我的應(yīng)用程序不在前臺(tái)也是如此.如果是,那么我可以閱讀有關(guān)該呼叫的詳細(xì)信息,例如持續(xù)時(shí)間,是否未接,已撥或已接.提前致謝.
I am new to ios. I was wondering if there is any way to detect the call events like incoming call, outgoing call even if my app is not in foreground. And if yes it is possible then can i read the details about that call like duration, whether it is missed, dialed or recieved. Thanks in advance.
推薦答案
是的,您可以檢測(cè)到呼叫.但前提是您的應(yīng)用程序在前臺(tái)運(yùn)行.為此,您可以使用核心電話(huà)框架.
Yes you can detect a Call. but only if your app is running in the foreground. For this you can use the Core Telephony Framework.
如果您的應(yīng)用屬于任何后臺(tái)運(yùn)行類(lèi)別(VOIP、音頻、位置跟蹤或附件),您也許可以使用CTCallCenter代碼> 在后臺(tái).但請(qǐng)注意,如果您錯(cuò)過(guò)將后臺(tái)運(yùn)行模式用于不適合的用途,Apple 會(huì)拒絕您的應(yīng)用.
If your app will fall in any of the background running categories (VOIP, AUDIO, Location tracking or accessory ) you might be able to use the
CTCallCenter
in the background. But be aware that Apple will reject you app if you miss use the background running mode for something it was not meant for.
CTCallCenter
將允許您檢測(cè)任何已啟動(dòng)或正在進(jìn)行的呼叫.
The CTCallCenter
will allow you to detect any calls that are started or already in progress.
但是,您將無(wú)法檢測(cè)到有關(guān)呼叫的任何詳細(xì)信息,CTCall
識(shí)別調(diào)用只會(huì)告訴你這個(gè)狀態(tài).CTCall
只會(huì)為您提供呼叫的唯一標(biāo)識(shí)符,而不是被呼叫的號(hào)碼.
However you will not be able to detect any detail about the call, the CTCall
identifying the call will only tell you this state. The callID
of CTCall
will just give you an unique identifier for the call but not the number being called.
這篇關(guān)于檢測(cè)ios中的通話(huà)事件的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!