https://github.com/sendbird/quickstart-calls-directcall-android
Sendbird Calls for Android sample, guiding you to build a real-time voice and video calls quickly and easily.
https://github.com/sendbird/quickstart-calls-directcall-android
android call calls calls-sdk quickstart rtc sample-android sendbird-application video-call voip webrtc
Last synced: 6 months ago
JSON representation
Sendbird Calls for Android sample, guiding you to build a real-time voice and video calls quickly and easily.
- Host: GitHub
- URL: https://github.com/sendbird/quickstart-calls-directcall-android
- Owner: sendbird
- Created: 2019-12-04T23:34:35.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2024-08-08T06:44:00.000Z (about 1 year ago)
- Last Synced: 2025-04-24T06:54:39.789Z (6 months ago)
- Topics: android, call, calls, calls-sdk, quickstart, rtc, sample-android, sendbird-application, video-call, voip, webrtc
- Language: Java
- Homepage: https://sendbird.com
- Size: 1.74 MB
- Stars: 17
- Watchers: 15
- Forks: 13
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Sendbird Calls for Android Quickstart

[](https://play.google.com/store/apps/details?id=com.sendbird.calls.quickstart)## Introduction
Sendbird Calls SDK for Android is used to initialize, configure, and build voice and video calling functionality into your Android client app. In this repository, you will find the steps you need to take before implementing the Calls SDK into a project, and a sample app which contains the code for implementing voice and video call.
### More about Sendbird Calls for Android
Find out more about Sendbird Calls for Android on [Calls for Android doc](https://sendbird.com/docs/calls/v1/android/getting-started/about-calls-sdk). If you need any help in resolving any issues or have questions, visit [our community](https://community.sendbird.com).
## Before getting started
This section shows you the prerequisites you need for testing Sendbird Calls for Android sample app.
### Requirements
The minimum requirements for Calls SDK for Android sample are:
- Android 4.1 (API level 16) or higher
- Java 8 or higher
- Gradle 3.4.0 or higher
- Calls SDK for Android 1.5.1 or higherFor more details on **installing and configuring the Calls SDK for Android**, refer to [Calls for Android doc](https://sendbird.com/docs/calls/v1/android/getting-started/install-calls-sdk#2-step-2-install-the-calls-sdk).
## Getting started
If you would like to try the sample app specifically fit to your usage, you can do so by following the steps below.
### Create a Sendbird application
1. Login or Sign-up for an account on [Sendbird Dashboard](https://dashboard.sendbird.com).
2. Create or select a calls-enabled application on the dashboard.
3. Note your Sendbird application ID for future reference.### Create test users
1. On the Sendbird dashboard, navigate to the **Users** menu.
2. Create at least two new users: one as a `caller`, and the other as a `callee`.
3. Note the `user_id` of each user for future reference.### Specify the Application ID
To run the sample Android app on the Sendbird application specified earlier, your Sendbird application ID must be specified. On the sample client app’s source code, replace `SAMPLE_APP_ID` with `APP_ID` which you can find on your Sendbird application information.
```java
public class BaseApplication extends Application {
...
private static final String APP_ID = "SAMPLE_APP_ID";
...
}
```### Build and run the sample app
1. Build and run the sample app on your Android device.
2. Install the application onto at least two separate devices for each test user you created earlier.
3. If there are no two devices available, you can use an emulator to run the application instead.For more detail on how to build and run an Android application, refer to [Android Documentation](https://developer.android.com/studio/run).
## Making your first call
### How to make a call
1. Log in to the sample app on the primary device with the user ID set as the `caller`.
2. Log in to the sample app on the secondary device using the ID of the user set as the `callee`. Alternatively, you can also use the Calls widget found on the Calls dashboard to log in as the `callee`.
3. On the primary device, specify the user ID of the `callee` and initiate a call.
4. If all steps are followed correctly, an incoming call notification will appear on the device of the `callee`.
5. Reverse the roles. Initiate a call from the other device.
6. If the two testing devices are near each other, use headphones to make a call to prevent audio feedback.
## Advanced
### Create a local video view before accepting an incoming call
You can create how the current user’s local video view will show on the screen before accepting an incoming call. Follow the steps below to customize the current user’s local video view:
1. Start your call activity with an incoming call ID in the `onRinging()` method within the class where you implement code for receiving a call.
2. Get the `DirectCall` object with the incoming call ID within the `onCreate()` method of the call activity class.
3. Get the `SendBirdVideoView` object from the `xml` file of your call activity to add a local video view.
4. Call the `DirectCall.setLocalVideoView()` method by using the `SendBirdVideoView` object within the call activity class.```kotlin
// {YourApplication}.kt
SendBirdCall.addListener("${UUID.randomUUID()}", object : SendBirdCallListener() {
override fun onInvitationReceived(invitation: RoomInvitation) {}override fun onRinging(call: DirectCall) {
...val intent = Intent(applicationContext, YourCallActivity::class.java)
intent.putExtra("EXTRA_INCOMING_CALL_ID", call.getCallId())
...applicationContext.startActivity(intent)
}
})// {YourCallActivity}.kt
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
...val callId = intent.getStringExtra("EXTRA_INCOMING_CALL_ID")
val call = SendBirdCall.getCall(callId)
...
val localVideoView = findViewById(R.id.video_view_fullscreen)
call.setLocalVideoView(localVideoView)
}
``````xml
// {activity_your_call}.xml...
...```
### Sound Effects
You can use different sound effects to enhance the user experience for events that take place while using Sendbird Calls.
To add sound effects, use the `SendBirdCall.Options.addDirectCallSound(SendBirdCall.SoundType soundType, int resId)` method for the following events: dialing, ringing, reconnecting, and reconnected. Remember to set sound effects before the mentioned events occur. To remove sound effects, use the `SendBirdCall.Options.removeDirectCallSound(SendBirdCall.SoundType soundType)` method.
```kotlin
// Play on a caller’s side when making a call.
SendBirdCall.Options.addDirectCallSound(SendBirdCall.SoundType.DIALING, R.raw.dialing)
// Play on a callee’s side when receiving a call.
SendBirdCall.Options.addDirectCallSound(SendBirdCall.SoundType.RINGING, R.raw.ringing)
// Play when a connection is lost, but the SDK immediately attempts to reconnect.
SendBirdCall.Options.addDirectCallSound(SendBirdCall.SoundType.RECONNECTING, R.raw.reconnecting)
// Play when the connection is re-established.
SendBirdCall.Options.addDirectCallSound(SendBirdCall.SoundType.RECONNECTED, R.raw.reconnected)
```To make the dialing sound play when the device is on silent or vibrate mode, use the method below.
```kotlin
SendBirdCall.Options.setDirectCallDialingSoundOnWhenSilentOrVibrateMode(true)
```
## Reference
For further detail on Sendbird Calls for Android, refer to [Sendbird Calls SDK for Android README](https://github.com/sendbird/sendbird-calls-android/blob/master/README.md).