Search code examples
iosiphonevideocallkit

There is no delegate or notification when user pressed facetime button from callkit


I had a VoIP app which should support video call. So, I oppen the app, lock the screen, then receive an incoming audio call. The problem is I did not figure out how to get notify when user presssed on "facetime" (video call) button. Basicaly user is lead to the app but nothing is happening since I did know to what delegate or notification to listen.
I looked over Skipe app and it seems to get notified when video call button is pressed on the call screen. So when "facetime" button is pressed in Skipe app user is lead to the app and video stream begins.

In short words, can some one points me which kind of delegate or notification should I listen in order to get notify when user pressed on video button from call kit?


Solution

  • Acording to this post: https://stackoverflow.com/a/43487523/6296389, there is an AppDelegate method that notify the app when video buttons is pressed from native CallKit screen when phone is locked.
    Objective C delegate method is:

        - (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray *restorableObjects))restorationHandler
    

    You should check if:

        [userActivity.activityType isEqualToString:@"INStartVideoCallIntent"] 
    

    to identify if received action is a start video intent.

    Swift version

    func application(_ application: UIApplication,
              continue userActivity: NSUserActivity,
              restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
    
        if userActivity.activityType == "INStartVideoCallIntent" {
            // treat start video
        }
    }