如何使用呼叫目录扩展来识别我的应用程序中的来电? [英] How to use call directory extension to identify a incoming call in my application?

查看:123
本文介绍了如何使用呼叫目录扩展来识别我的应用程序中的来电?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究callKit框架,我发现通过使用调用目录扩展,我们可以识别传入的电话号码。我的问题是如何在iOS应用程序中实现调用目录扩展来识别传入的调用详细信息。我在Objective C工作。

I am working on callKit framework, I found that by the use of call directory extension, we can Identify the incoming phone number. My question how to implement a call directory extension in iOS app to identify incoming call detail. I am working in Objective C.

使用此方法将数字+ 919876xxxxx添加到呼叫目录扩展中:

Let a number "+919876xxxxx" add in call directory extension using this method:

- (BOOL)addIdentificationPhoneNumbersToContext:(CXCallDirectoryExtensionContext *)context {
    // Numbers must be provided in numerically ascending order.
    CXCallDirectoryPhoneNumber phoneNumbers[] = {+919876xxxxx};

    NSArray<NSString *> *labels = @[ @"Telemarketer"];
    NSUInteger count = (sizeof(phoneNumbers) / sizeof(CXCallDirectoryPhoneNumber));

    for (NSUInteger i = 0; i < count; i += 1) {
        CXCallDirectoryPhoneNumber phoneNumber = phoneNumbers[i];
        NSString *label = labels[i];
        [context addIdentificationEntryWithNextSequentialPhoneNumber:phoneNumber label:label];
    }
    return YES;
}

我在电话设置中使用呼叫阻止和识别功能。
当我从这个号码打电话时,它会显示[应用程序名称]来电显示:电话推销员。

And I on the call blocking and identification feature in the phone settings. When I call from this number it show the [App name] Caller ID: Telemarketer.

我的问题是如何在我的应用程序中知道这个号码所以我在表格中显示了这个数字。

My question is how can I know this number in my application so that I show this number in table.

提前致谢。

推荐答案

如果这个问题不是如何编写一个呼叫目录扩展,但是如何获取一个来电的号码,我认为这是什么问题,那就不可能了。

If this question is not how to write a call directory extension, but how to get the number of an incoming call, which I think is what the question is, then its not possible.

当有来电时,不涉及呼叫目录分机。所有这一切都是寄存器编号,这些编号存储在手机应用程序专用的内部SQL数据库中。当有来电时呼叫目录分机不会运行,因此它和你的应用无法识别来电号码,这与以往一样,在iOS 10中没有改变。

The call directory extension is not involved when there is an incoming call. All it does is register numbers that get stored in an internal SQL database that is private to the phone app. The call directory extension does NOT get run when there is an incoming call and therefore it and your app are not able to identify the number of an incoming call, this is the same as it has always been, it has not changed in iOS 10.

在iOS 10中添加了针对Voip应用程序的呼叫检测的新功能,但如果您不是voip应用程序,则仍无法获取传入的数量(或拨打电话。

There is new functionality for call detection for Voip apps that was added in iOS 10, but if you are not a voip app you still cannot obtain the number of an incoming (or outgoing) call.

这篇关于如何使用呼叫目录扩展来识别我的应用程序中的来电?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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