Making a call
Make a call#
Call feature is essential for the modern day communication. Call sdk allows users to make a one to one audio/video call with the another sdk user.
Note: You need to check the required runtime permissions before calling call sdk methods. if required permissions are not available
isSuccesswill befalseand error message will be given in callback.
Required runtime permissions#
For audio call, we need a below permissions:
You can use the below method to check audio call permissions:
- Java
- Kotlin
For video call, we need below permissions:
You can use the below method to check video call permissions:
- Java
- Kotlin
From Android 12, ensure that
android.permission.BLUETOOTH_CONNECTandandroid.permission.READ_PHONE_STATEruntime permissions are granted for your app for seameless audio routing and gsm call handling. If theandroid.permission.BLUETOOTH_CONNECTpermission is not granted, call audio will not be routed to BT Headset even though it is connected. If theandroid.permission.READ_PHONE_STATEpermission is not granted, gsm call related functionalities will not work in sdk.
Note: From Android 13, CallSDK need below permission to show ongoing call notification.
You can use the below method to check call notification permission:
- Java
- Kotlin
| Argument | Type | Description |
|---|---|---|
| TO_JID | String | jid of the call receiver |
| CALLBACK | CallActionListener | callback to observe the action status |
Make a voice call#
Make voice call feature allows users to make a one to one audio call with the another sdk user. You can make a voice call using the below method.
- Java
- Kotlin
caution
If one to one call feature unavailable for your plan then it will throw 403 exception.
Make a video call#
Make video call feature allows users to make a one to one video call with the another sdk user. You can make a video call using the below method.
- Java
- Kotlin
caution
If one to one call feature unavailable for your plan then it will throw 403 exception.
Make a group voice call#
Make group voice call feature allows users to make a voice call with multiple sdk users. You can make a group voice call using the below method.
| Argument | Type | Description |
|---|---|---|
| JID_LIST | List<String> | jid list of the callee's |
| GROUP_ID | String | Group id of the group from which call initiated |
| CALLBACK | CallActionListener | callback to observe the action status |
- Java
- Kotlin
caution
If group call feature unavailable for your plan then it will throw 403 exception.
Make a group video call#
Make group video call feature allows users to make a video call with multiple sdk users. You can make a group video call using the below method.
- Java
- Kotlin
caution
If group call feature unavailable for your plan then it will throw 403 exception.
Add participants to the call#
After call is connected, you can able to add users to the ongoing call. sdk provides methods to invite users to the call, once they accepted the incoming call, they will join in the ongoing call.
| Argument | Type | Description |
|---|---|---|
| JID_LIST | List<String> | jid list of the callee's |
- Java
- Kotlin
caution
If group call feature unavailable for your plan then it will throw 403 exception.
Receiving a incoming audio/video call#
Whenever you receive the audio/video call from the another sdk user, call sdk will show notification if device android
version is greater than or equal to Android 10 (API level 29), otherwise the activity which you set using the
CallManager.setCallActivityClass() method during call sdk initialisation will be started with the call details.
sample call ui will be available for quick integration.
caution
Please don't forget to set activity class for call sdk using CallManager.setCallActivityClass().
Answer the incoming call#
Whenever you receive the audio/video call from the another sdk user, depending upon the android version, you activity may be started so whenever user presses accept button from your call UI , you need to call the below sdk method to answer the call and notify the caller.
Note: if the required permissions are not available then call be will be automatically declined even though you answered a call
| Argument | Type | Description |
|---|---|---|
| CALLBACK | CallActionListener | callback to observe the action status |
- Java
- Kotlin
Decline the incoming call#
Whenever you receive the audio/video call from the another sdk user, depending upon the android version, you activity may be started so whenever user presses decline button from your call UI , you need to call the below sdk method to decline the call and notify the caller.
- Java
- Kotlin
Disconnect the ongoing call#
Whenever you make the audio/video call to the another sdk user and you just want to disconnect the call before getting connected or if you want to just disconnect a connected call after the end of conversation, whenever user presses the disconnect button from your call UI , you need to call the below sdk method to disconnect the call and notify the caller.
Note: The below method accepts
CallActionListeneras a optional paramter. you can pass the listener to get disconnect success callback
- Java
- Kotlin
info
Call Sdk requires chat sdk integration for user management.