Quickstart
Channelize.io Android Call SDK along with API SDK and UI SDK helps you achieve the complete calling and real-time messaging solution.
NOTE: Channelize.io Android Call SDK is using Channelize.io API SDK for networking and real-time events.
NOTE: Please ensure you have already implemented push notification in your app.
Install and configure Android Call SDK
Step 1: Create your Channelize.io Application
To initialize SDK you need to pass the Public Key of you application to accesss Android API SDK, which you will get from the Channelize.io dashboard under My Account > Application Settings for the respective application.
Step 2: Install the SDK
To install the Call SDK using .gradle, add the following lines to a build.gradle file at the app level.
build.gradle
dependencies {
implementation 'com.github.ChannelizeIO.Channelize-Android-SDK:channelizecall:4.3.40'
}
Step 3: Grant system permissions and add Channelize.io Call Id
To use all features of Android Call SDK grant system permissions by adding the following lines to the AndroidManifest.xml
file.
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<uses-permission android:name="android.permission.VIBRATE" />
NOTE: Add all the meta-data inside <application>
tag.
Channelize.io Call Id: Add the Channelize.io Call Id in AndroidManifest.xml
file. Replace the "APP_ID" in value with your Channelize.io Call Id that you'll get from Channelize.io support team after Signup. To get Channelize.io Call Id drop an email at support@channelize.io.
<meta-data android:name="com.channelize.call.AGORA_APP_ID" android:value="APP_ID" />
Integrate Call SDK
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 below method should be called once across the application. Initializing the Android Call SDK in the onCreate()
method of the Application instance is recommended.
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 the @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);