Quickstart
This quickstart shows how to use Dyte's core SDKs to add live video and audio to your Android applications.
To get started quickly, you can use our sample code. You can clone and run a sample application from the Android Core samples, available in both Kotlin and Java.
Objective
You'll learn how to:
- Install the Dyte SDK
- Initialize the SDK
- Configure a Dyte meeting
- Initialize the Dyte meeting
- Go live with your Dyte meeting
Before Getting Started
Make sure you've read the Getting Started with Dyte topic and completed the following steps:
- Create a Dyte Developer Account
- Create a Dyte Meeting
- Add Participant to the meeting
- Install Android Studio
Step 1: Install the SDK
To install the SDK, add the core-android
dependency to your app's build.gradle
file:
dependencies {
// (other dependencies)
implementation 'io.dyte:core-android:+'
}
If your app targets lower versions of Android (Android API <= 24), please enable core desugaring in your app's build.gradle file as follows.
android {
// other configurations
compileOptions {
// other configurations
isCoreLibraryDesugaringEnabled = true
}
}
dependencies {
// other dependencies
coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.0.4")
}
Step 2: Initialize the SDK
The DyteMobileClient
is the main class of the SDK. It is the entry point and
the only class required to initialize Dyte SDK.
- Kotlin
- Java
val dyteClient = DyteMeetingBuilder.build(activity)
DyteMobileClient dyteClient = DyteMeetingBuilder.build(activity);
Step 3: Configure a Dyte meeting
Configure the following properties in the DyteMeetingInfoV2
class. You must pass a valid participant authToken
obtained from
the Add Participant API.
Name | Description |
---|---|
authToken | After you've created the meeting, add each participant to the meeting using the Add Participant API The API response contains the authToken . |
enableAudio | Set whether to join the meeting with your Mic ON (true ) or OFF (false ). |
enableVideo | Set whether to join the meeting with your Camera ON (true ) or OFF (false ). |
baseUrl | Base URL of the dyte's environment you have created the meeting on. |
- Kotlin
- Java
val meetingInfo =
DyteMeetingInfoV2(
authToken = AUTH_TOKEN,
enableAudio = true,
enableVideo = true,
baseUrl = "dyte.io"
)
DyteMeetingInfoV2 meetingInfo = new DyteMeetingInfoV2(
MeetingConfig.AUTH_TOKEN, // auth_token
true, // enableAudio
true, // enableVideo
"dyte.io" // baseUrl
);
Step 4: Initialize the Dyte meeting
To initialize the meeting, call the init()
method on the dyteClient
object with the meetingInfo
argument. This establishes
a connection with the Dyte meeting server.
- Kotlin
- Java
dyteClient.init(meetingInfo, {
// init complete
}, {
// init failed
}
)
dyteClient.init(meetingInfo, () -> {
// init complete
return null;
}, () -> {
// init failed
return null;
});
Step 5: Go live with your Dyte meeting!
Now, you have established the connection with the Dyte meeting server successfully. Next step is to join the room.
Join the room
To join the meeting room, call joinRoom()
method on the dyteClient
instance as shown below.
- Kotlin
- Java
dyteClient.joinRoom({
// join complete
}, {
// join failed
}
)
dyteClient.join(() -> {
// join complete
return null;
}, () -> {
// join failed
return null;
});
Leave the room
Once the meeting is over, you can leave the meeting room.
To leave the meeting room, call leaveRoom()
method on the dyteClient
as shown below.
- Kotlin
- Java
dyteClient.leaveRoom({
// leave completed
}, {
// leave failed
})
dyteClient.leave(() -> {
// leave complete
return null;
}, () -> {
// leave failed
return null;
});