1

I'm planning to create an iOS VoIP app(not made any iOS app before). I was reading about Callkit in IOS by which one can make his app receive phone call through iPhone native call screen.

I read Callkit api here where it is mentioned that one can know if a call is answered.

Going through this tutorial and here is the code which detects the call is answered:

-(void)reportIncomingCallWithHandle:(NSString *)handle
                            success:(void (^)())success
                            failure:(void (^)(NSError * error))failure {
    CXCallUpdate *update = [self newCallUpdateWithHandle:handle];
    self.callId = [NSUUID UUID];

    [self.provider reportNewIncomingCallWithUUID:self.callId update:update completion:^(NSError * _Nullable error) {
        if (error) {
            if (failure) failure(error);
        } else {
            if (success) {
                success();
            }
        }
    }];
}

See the success block. So is there is a way to open my app when this success block executed? Or can I override default buttons on caller screen to open my app?

I know there is no way to open an app on receiving any kind of notification, or event trigger. So thought may be there is some way if I can do the same using Callkit

I Googled everything but found no clue regarding my above queries. Please help me if it is possible or not.

Community
  • 1
  • 1
Choxx
  • 945
  • 1
  • 24
  • 46

2 Answers2

5

I encountered the same issue. The behavior varies depending on if the device is locked or not.

  1. Locked: System calling screen appears. You can run the app in the background including view transitions. However, the user will only see the system calling screen although your app is kind of presented underneath the view. As the device is locked, deep links does not work as well.
  2. Unlocked: Calling screen is the same but once the user answers the call, the app will be presented.

As you may know, we can change the icon of the button on the calling screen which opens the app, and that's the best we can do as of now.

  • How we can change the icon of the button on the calling screen which opens the app? – Varinder Singh iPhone Dev Aug 10 '17 at 11:50
  • 1
    @VarinderSingh There is a property for this icon in CXProviderConfiguration. Check documentation for details https://developer.apple.com/documentation/callkit/cxproviderconfiguration/2274376-icontemplateimagedata – Lveecode Sep 18 '17 at 12:26
  • @Leetmorry. Thanks, Solved. – Varinder Singh iPhone Dev Sep 22 '17 at 07:49
  • @Yusuke Kawanabe I;m also facing same issue, If i answer from lock screen, Audio streaming is not working, Have you found any soluation for this? – Sonu Jan 13 '18 at 08:36
  • @Sonu There is nothing special you have to do but simply give audio permission and open VoIP session. If I remember correctly, you can't get microphone permission when the device is locked and the app runs in the background. – Yusuke Kawanabe Jan 23 '18 at 19:02
  • @YusukeKawanabe i already provide permission, Still, It's not working when device is locked. – Sonu Jan 30 '18 at 10:48
2

You can not open your own VoIP app or custom UI of your App from CallKit. Use can use it in a way as Whatsapp does.

Means you can awake your app from background without using local notification. And OS will show the default incoming screen. You need not to handle anything during call. CallKit is specially made for enhancing VoIP apps by receiving calls in background, by making outgoing calls, by managing Call directory and blocking of users.

  • See the comment by **Stuart** on this http://stackoverflow.com/a/39678893/4512651 . He says the app will be opened if the screen is not locked. – Choxx Jan 20 '17 at 05:28
  • App will be opened only if you have been implemented CallKit in your app. – Krishna Datt Shukla Aug 25 '17 at 06:59
  • @KrishnaDattShukla I've another problem, In my case, If screen is locked, Audio is not passing, It's start working if i open app while call. Do you have any idea about this? – Sonu Jan 02 '18 at 13:05
  • @Sonu, are you using call kit ? – Krishna Datt Shukla Jan 03 '18 at 06:56
  • @KrishnaDattShukla Yes, I'm using it. Sometimes first call is working on lock screen, but sometime only not always. When i unlock screen it's start Audio streaming normally. For Call, I'm using AppRTC – Sonu Jan 04 '18 at 06:41
  • It seems to be a bug in Callkit itself. I got this issue with Whatsapp too. – Krishna Datt Shukla Jan 05 '18 at 06:09