logo
On this page

Integrate Audio and Video Calling Features

This document introduces how to use the ZEGOCLOUD Call Kit to add audio and video calling capabilities to ZIMKit.

Android_call_demo.gif

Implementation Process

1
Integrate IMKit

Please refer to the Quick Start to integrate IMKit. If it has already been integrated, you can skip this step.

2
Add CallKit Dependency

Modify your app module's build.gradle file and add the CallKit dependency:

Untitled

dependencies {
    ...
    implementation 'com.github.ZEGOCLOUD:zego_uikit_prebuilt_call_android:+'    // add this line in your module-level build.gradle file's dependencies, usually named [app].
}
1
Copied!
3
Adjust IMKit Initialization Method

In previous steps, you used the following code to initialize ZIMKit:

Untitled
Long appId = ;    // The AppID you get from ZEGOCLOUD Admin Console.
String appSign = ;    // The App Sign you get from ZEGOCLOUD Admin Console.
ZIMKit.initWith(this,appId,appSign);    
ZIMKit.initNotifications();    // Online notification for the initialization (use the following code if this is needed).
1
Copied!

To integrate the audio and video calling feature, you need to use the method with ZIMKitConfig class parameters for initialization:

Untitled
ZIMKitConfig zimKitConfig = new ZIMKitConfig();
Long appId = ;    // The AppID you get from ZEGOCLOUD Admin Console.
String appSign = ;    // The App Sign you get from ZEGOCLOUD Admin Console.
ZIMKit.initWith(this,appId,appSign,zimKitConfig);    
ZIMKit.initNotifications();  // Online notification for the initialization (use the following code if this is needed).
1
Copied!
4
Enable CallKit Features

In the ZIMKitConfig class, we can enable the audio and video calling features by creating a ZegoCallPluginConfig object:

Untitled
ZIMKitConfig zimKitConfig = ;
// ...
zimKitConfig.callPluginConfig = new ZegoCallPluginConfig();
1
Copied!
5
Add Audio Video Call Buttons

After enabling the CallKit feature, we can add audio and video call buttons by configuring the ZIMKitConfig's ZIMKitInputConfig parameter:

Untitled
ZIMKitConfig zimKitConfig = new ZIMKitConfig();
zimKitConfig.callPluginConfig = new ZegoCallPluginConfig();
zimKitConfig.inputConfig.expandButtons.add(ZIMKitInputButtonName.VOICE_CALL);
zimKitConfig.inputConfig.expandButtons.add(ZIMKitInputButtonName.VIDEO_CALL);
1
Copied!

After configuration, the input box on the chat page will have voice and video calling buttons. Clicking on them will bring up a secondary menu where you can choose to make a video call or a voice call (group calls are not supported at the moment).

More resources

The above content only introduces the basic configuration required to integrate the audio and video calling UIKit. If you need to further customize the call configuration, you can set:

Untitled
ZIMKitConfig zimKitConfig = ;
// ...
zimKitConfig.callPluginConfig = new ZegoCallPluginConfig();
// Customize call configuration
ZegoUIKitPrebuiltCallInvitationConfig invitationConfig = new ZegoUIKitPrebuiltCallInvitationConfig();
zimKitConfig.callPluginConfig.invitationConfig = invitationConfig; // opt,invitationConfig for call
zimKitConfig.callPluginConfig.resourceID = ; // opt,resourceID for call
1
Copied!

For information on customizing call functions using ZegoUIKitPrebuiltCallInvitationConfig, please refer to the following documentation: