Understanding CallDirectory extension

Hi there,

I'm trying to create an extension for my app so that it identifies caller.

I followed https://developer.xamarin.com/guides/ios/platform_features/introduction-to-ios10/callkit/#Implementing-a-Call-Directory-Extension

and manually added my office phone number as known identity. I made sure my phone number is not already stored in my phone and try to call me but my office name is not showing, this is just an unknown caller ringing.

I tried to remove my app from my device and deploy again, it does not help.

Reading https://developer.xamarin.com/guides/ios/platform_features/introduction_to_extensions/ it looks like extensions may need to be "enabled" somewhere. How do I find how this should be done? It is written the app itself may ask the device to invoke the extension, how?

Best Answer

Answers

  • LarryOBrienLarryOBrien USXamarin Team Xamurai

    I'm afraid this is only a debugging question, but if you open the Console.app and check your device's log at the time of the call, do you see any error messages? (Perhaps specifically one saying there was a connection problem: ""connection to service named {your app}"...)

  • bjarteaobjarteao NOMember ✭✭

    @XavierPerseguers: Since I wrote my answer, I have figured out how to run the extension from the app. Here is how:

    var callDirManager = CXCallDirectoryManager.SharedInstance;
    callDirManager.ReloadExtension("com.mycompany.myappname.myextension", error =>
    {
        if (error == null)
        {
            // Ran extension successfully
        } else {
            // Extension failed, log error.Code and error.Description
            // Here are the meaning of the error codes:     
            // https://developer.apple.com/reference/callkit/cxerrorcodecalldirectorymanagererror.code/
        }
    });
    

    This does the same as going into the phone's settings like I described in my last post and deactivate and reactivate the app extension.

    If your extension works like Xamarin's sample app, running the ReloadExtension method will clean out any phone numbers you have added to the call directory and then run the code to insert phone numbers into the call directory (blocking or identifying phone numbers, depending on your code).

  • bjarteaobjarteao NOMember ✭✭
    edited January 2017

    @LarryOBrien I don't think you will get any messages from the extension when you receive a call, because the extension never knows anything about incoming calls.

    You get error messages when the extension is run, which is either when you activate it in the phone's settings or when you run the ReloadExtension method from your app, as described in my previous post.

  • XavierPerseguersXavierPerseguers CHMember ✭✭✭

    Yes, seems like there is no way to hook into iOS when receiving a call, which defeats the use case I wanted to do, that is allow a privately shared external directory of names/phones to be used to identify any unknown incoming call, by just searching for it using a private API.

  • Please help us. Call Directory Extension – Error Enabling Extension. Failed to request data
    Our app is using the caller id feature of Call Directory Extension (Xamarin Form). It seems to work well for most users. However 1 case in iphone 7 plus that we cannot enable the extension in Settings > Phone > Call Blocking & Identification. I gets the message “Error Enabling Extension. Failed to request data for appName. You may try enabling the extension again…”. What is a root cause of this error. Please let us know. Thanks so much.

Sign In or Register to comment.