Integration
Step 1: Initialize the SDK
SDK Initialization will bind the SDK to Android’s context, thereby allowing it to respond to the connection and state changes. When using Android Call SDK with Android UI SDK you just need to enable the calling feature at the time of UI SDK initialization.
The ChannelizeUI.initialize(channelizeUIConfig)
method should be called once across the application. Initializing the Android UI SDK in the onCreate()
method of the Application instance is recommended.
// To customize the UI, access the ChannelizeUIConfig class and set the customized method's value. Few of them are mentioned below.
ChannelizeUIConfig channelizeUIConfig = new ChannelizeUIConfig.Builder()
.enableCall(true) // Set true if you want to enable the calling feature otherwise set it false.
.build();
ChannelizeUI.initialize(channelizeUIConfig);
Initialize the Channelize.io Call SDK with the below method. This method will also be used when using Android Call SDK without Android UI SDK.
ChannelizeCall.initializeCallSDK();
Step 2: Connect to Channelize.io server
To get the updates in SDK, you need to connect to the Channelize.io server to publish/receive the real-time updates.
Channelize.connect();
Step 3: Initialize Handler
Add ChannelizeCallEventHandler to get an update on incoming calls and invoke the Channelize.io Android Call SDK for the same. The rest will be handled by the Android Call SDK.
ChannelizeCall.getInstance().addCallEventHandler(new ChannelizeCallEventHandler() {
/**
*
* @param callId The unique ID of the call.
* @param callType Type of the call i.e voice or video.
* @param user The User model instance.
*/
@Override
public void onIncomingCall(String callId, String callType, User user) {
}
/**
*
* @param callId The unique ID of the call.
* @param userId The unique ID of the user who has ended the call.
*/
@Override
public void onCallEnd(String callId, String userId) {
}
});
Outgoing Call
Make an outgoing call using the below method.
/**
* @param CALL_TYPE The type of the call and must be one of: Must be one of @CallType. ({VOICE_CALL, VIDEO_CALL})
* @param USER_MODEL The user model of the call receiver.
*/
ChannelizeCall.getInstance().initiateCall(CALL_TYPE, USER_MODEL);
Incoming Call
On an incoming call event invoke the below method.
/**
* @param CONTEXT The context of the application.
* @param CALL_ID The unique ID of the call.
* @param CALL_TYPE The type of the call that you'll get inside onIncomingCall() method of the ChannelizeCallEventHandler.
* @param USER_MODEL The user model of the user from which you're receiving the call.
*/
ChannelizeCall.getInstance().receiveIncomingCall(CONTEXT, CALL_ID, CALL_TYPE, USER_MODEL);