Skip to main content

Android

Quickstart

This quickstart shows how to add Dyte's Interactive Livestream SDK to your Android applications.In addition, you'll learn how Dyte's UI component library can help you build your UI faster with components designed specifically for Interactive Livestream applications.

You can also checkout our sample code for Android. You can clone and run a sample application from the Android Samples GitHub repository.

Objective

You'll learn how to:

  • Install the Dyte client-side SDKs
  • Initialize Dyte client
  • Bringing up your UI
  • Go live!

Before Getting Started

Make sure you've a mechanism to get authToken from your server-side, which you would have received as part of Add Participant call.

Step 1: Install the SDK

  1. Install the SDK using maven central dependency.
dependencies {
// (other dependencies)
implementation 'io.dyte:uikit:+'
}
  1. Add the following permissions to the AndroidManifest.xml file.
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
Note

Release builds (or any other Proguard builds) require an additional setup step, refer to the Proguard Builds section.

Step 2: Initialisation configuration

Set the properties in the DyteMeetingInfoV2 class. You just need to provide the participant's authToken.

NameDescription
authTokenAfter you've created the meeting,
add each participant to the meeting
using the Add Participant API
(The presetName created earlier
must be passed in the body
of the Add Participant API request)
The API response contains the authToken.
val meetingInfo = DyteMeetingInfoV2(
authToken = '<auth_token>',
)

Step 3: Initialize the SDK

The DyteUIKitBuilder is the main class of the SDK. It is the entry point and the only class required to initialize Dyte SDK.

val dyteUIKitInfo = DyteUIKitInfo(
activity = this,
dyteMeetingInfo = meetingInfo
)
val dyteUIKit = DyteUIKitBuilder.build(dyteUIKitInfo)

Step 4: Launch the meeting UI

To launch the meeting UI all you need to do is call startMeeting() which will take care of everything for you.

dyteUIKit.startMeeting()

meeting UI screenshot with labeled parts meeting UI screenshot with labeled parts meeting UI screenshot with labeled parts

Proguard Builds

Perform the following steps, for Android release builds/proguard builds:

  1. Create /android/app/proguard-rules.pro file.
# Keep `Companion` object fields of serializable classes.
# This avoids serializer lookup through `getDeclaredClasses` as done for named companion objects.
-if @kotlinx.serialization.Serializable class **
-keepclassmembers class <1> {
static <1>$Companion Companion;
}

# Keep `serializer()` on companion objects (both default and named) of serializable classes.
-if @kotlinx.serialization.Serializable class ** {
static **$* *;
}
-keepclassmembers class <2>$<3> {
kotlinx.serialization.KSerializer serializer(...);
}

# keep webrtc classes
-keep class org.webrtc.** { *; }
-dontwarn org.chromium.build.BuildHooksAndroid

# keep ktor classes
-keep class io.ktor.** { *; }

  1. Add the following to your android/app/build.gradle to import the proguard configuration.
buildTypes {
release {
...
...
...
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}