Skip to main content

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:

Before Getting Started

Make sure you've read the Getting Started with Dyte topic and completed the following steps:

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:+'
}
Note

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.

val 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.

NameDescription
authTokenAfter you've created the meeting, add each participant to the meeting using the Add Participant API The API response contains the authToken.
enableAudioSet whether to join the meeting with your Mic ON (true) or OFF (false).
enableVideoSet whether to join the meeting with your Camera ON (true) or OFF (false).
baseUrlBase URL of the dyte's environment you have created the meeting on.
val meetingInfo =
DyteMeetingInfoV2(
authToken = AUTH_TOKEN,
enableAudio = true,
enableVideo = true,
baseUrl = "dyte.io"
)

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.

dyteClient.init(meetingInfo, {
// init complete
}, {
// init failed
}
)

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.

dyteClient.joinRoom({
// join complete
}, {
// join failed
}
)

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.

dyteClient.leaveRoom({
// leave completed
}, {
// leave failed
})