Start your first live
Sendbird Live SDK for Android offers a variety of functionalities for hosting and watching live events. As a live event's host, a user can create, share their media stream, and use the chat to communicate with other users watching the live event. Users can enter a live event as participants to watch the live event and use the chat to communicate with the live event's host as well as other users.
The minimum requirements for the Live SDK for Android are:
- Android 5.0 (API level 21) or later
- Java 8 or higher
- Support androidx only
- Android Gradle plugin 4.0.1 or higher
- Sendbird Chat SDK for Android 4.12.0 or higher
Before you start
Sendbird Live SDK provides live streaming feature and uses open channels from Sendbird Chat SDK for chat. Installing Sendbird Live SDK will automatically install the Chat SDK as well.
Before installing the Live SDK, create a Sendbird account to acquire an application ID which you will need to initialize the Live SDK. Go to Sendbird Dashboard and create an application by selecting Calls+Live in product type. Once you've created an application, go to Overview and you will see the Application ID.
You can start building your a live event by installing the Live SDK first.
Step 1 Create a project
To get started, open
Android Studio and create a new project for the Live UIKit in the Project window as follows:
Click Start a new Android Studio project in the Welcome to Android Studio window.
Select Empty Activity in the Select a Project Template window and click Next.
Enter your project name in the Name field in the Configure your project window.
Select your language as either Java or Kotlin from the Language drop-down menu.
Make sure Use legacy android.support.libraries is unchecked.
Select minimum API level as 21 or higher.
Step 2 Install the Live SDK
You can install the Live UIKit for Android through
Gradle. If you're using Gradle 6.7 or lower, add the following code to your root
Note: Make sure the above code block isn't added to your module
If using Gradle 6.8 or higher, add the following to your
Note: To learn more about updates to Gradle, visit this page.
Next, for all Gradle versions, open the
build.gradle file at the application level. For both
Kotlin, add the following code block and dependencies.
Before saving the
build.gradle file, check if you’ve enabled
viewBinding. Then, click the Sync button to apply all changes.
Step 3 Request permission to access camera and microphone
Your users need to grant the client app the permission to access camera and microphone to stream media. They also need to allow access to the photo library to send and download images and videos.
Step 4 Initialize the SendbirdLiveSDK instance
To integrate the Live SDK in the client app, you need to initialize it first. But, prior to initializing the Live SDK, you must initialize Sendbird Chat SDK first. Refer to the following documentation to understand how to initialize Sendbird Chat SDK.
After initializing Sendbird Chat SDK, initialize the
SendbirdLive instance using the
SendbirdLive.init() method. Initialization requires your Sendbird application's Application ID, which can be found on the Sendbird Dashboard.
SendbirdLive.init()method must be called across the client app at least once. It is recommended to initialize the Live SDK with the
onCreate()method of the Application instance.
Step 5 Authenticate a user
To start or enter a live streaming, you need to authenticate a user with the Sendbird server using their user ID through the
Authenticating a user with the Live SDK will also authenticate the user in the Chat SDK if you haven't authenticated the user in the Chat SDK yet. After authenticating the user, you can start broadcast or watch live events.
Step 6 Create a live event
To start a live event, you need to create one first. A live event can be created using the
SendbirdLive.createLiveEvent() method, and you can configure information about the live event through the
Step 7 Start your first live
When a live event is created, you can choose to enter as a host or a participant.
If you've entered as a host, you can start the live event by making the following call.
Step 8 Watch your first live
when a host and participants enter the live event, you can stream the first live event for participants to watch with Sendbird Live. The host and participants also can actively engage in the live event by chatting with each other.