Sendbird Calls for Android enables real-time voice and video calls for 1-to-1 calls or group calls among users within your Sendbird-integrated app. Our development kit can initialize, configure, and build voice and video calling functionality in your Android app.
The minimum requirements for Calls SDK for Android are:
Android 4.1 (API level 16) or higher
Java 8 or higher
Gradle 3.4.0 or higher
You can start making a 1-to-1 call with Direct call or create a room to start a group call with Group call by installing Sendbird Calls for Android.
To get started, open Android Studio and create a new project for Calls in the Project window as follows:
Click Start a new Android Studio project in the Welcome to Android Studio window.
Select Empty Activity and click Next.
Enter your project name in the Name field.
Select your language as either Java or Kotlin from the Language drop-down menu.
Select minimum API level as 16 or higher.
You can install Calls for Android through
Gradle. Begin by opening the root
build.gradle file and add the code blocks below:
Note: Make sure the above code block isn't added to your module
Then, add the dependency to your module
Note: Call SDK versions
1.5.3or lower can be downloaded from JCenter until February 1, 2022. SDK versions higher than
1.5.3will be available on Sendbird's remote repository.
The Calls SDK requires system permissions. To allow the Calls SDK to record audio and discover bluetooth devices, add the following lines to the
RECORD_AUDIO permissions are considered as dangerous permissions and require user agreement when your app is first launched on a user’s device with Android 6.0 or higher.
Note: For more information about requesting app permissions, see the Android’s Request app permissions guide.
When you build your APK with
minifyEnabled true, add the following line to the module's
ProGuard rules file.
To integrate and run Sendbird Calls in your application, you need to initialize it first. Initialize the
SendBirdCall instance by using the
APP_ID of your Sendbird application, which can be found on the Sendbird Dashboard after creating an application. If the instance is initialized with a different
APP_ID, all existing call-related data in a client app will be cleared and the
SendBirdCall instance will be initialized again with the new
Note: Each Sendbird application can be integrated with a single client app. Within the same application, users can communicate with each other across all platforms, whether they are on mobile devices or on the web.
SendBirdCall.init()method must be called at least once in your Android client app. It is recommended to initialize the Calls SDK in the
onCreate()method of the
To make and receive a 1-to-1 call or start a group call, authenticate a user to Sendbird server by using their user ID through the
After authenticating a user, you can continue to either make a 1-to-1 call with Direct call or start a group call with Group call. Skip to Step 11 if you wish to start a group call.
Note: You can implement both the Chat and Calls SDKs to your app. Two SDKs work on the same Sendbird application for them to share users. In this case, you can allow Calls to retrieve a list of users in the app by using the Chat SDK’s method or Chat API.
You can receive a 1-to-1 call by adding the user's device token to the server. You can add the token by using the
You can add a device-specific
SendBirdCallListener event handler using the
SendBirdCall.addSendBirdCallListener() method. Once the event handler is added, responding to device events such as incoming calls can be managed as shown below:
Note: If a
SendBirdCallListenerevent handler isn’t registered, a user can't receive an
onRingingcallback event. Thus, this handler should be added at the initialization of the app. Also, a
SendBirdCallListenerevent handler is automatically removed when the app closes by default.
You are now ready to make your first 1-to-1 call. To make a call, provide the callee’s user ID into the
SendBirdCall.dial() method. To choose initial call configuration such as as audio or video capabilities, video settings, and mute settings, use the
You can accept or decline an incoming call. To accept an incoming call, use the
directCall.accept() method. To decline a call, use the
directCall.end() method. If the call is accepted, a media session will automatically be established by the Calls SDK.
When creating your first room for a group call, you can choose either a room that supports up to 6 participants with video or a room that supports up to 25 participants with audio. When the room is created, a
ROOM_ID is generated.
RoomTypeproperty to set the room type.
createRoom()method to create a room as shown below.
You can now enter a room and start your first group call. When you enter a room, a participant is created with a unique participant ID to represent the user in the room.
To enter a room, you must acquire the room instance from Sendbird server with the room ID. To fetch the most up-to-date room instance from Sendbird server, use the
SendBirdCall.fetchRoomById() method. Also, you can use the
SendBirdCall.getCachedRoomById() method that returns the most recently cached room instance from Sendbird Calls SDK.
Note: A user can enter the room using multiple devices or browser tabs. Entering from each device or browser tab will create a new participant.
Once the room is retrieved, call the
enter() method to enter the room.
Note: Share the room ID with other users for them to enter the room from the client app.