Quickstart
This quickstart shows how to use Dyte's Android UI Kit SDK to add live video and audio to your Android applications.
For getting started quickly, you can use our sample code. You can clone and run a sample application from the Android UI Kit Sample App GitHub repository.
Objective
You’ll learn how to:
- Install the Dyte SDK
- Initialize the SDK
- Configure a Dyte meeting
- Launch the meeting UI
- Optional Release app on Play Store
Before Getting Started
Make sure you've read the Getting Started with Dyte topic and completed the steps in the Integrate Dyte section. You must complete the following steps:
- Create a Dyte Developer Account
- Create Presets
- Create a Dyte Meeting
- Add Participant to the meeting
- Install Android Studio
Step 1: Install the SDK
- Install the SDK using maven dependency.
// other dependencies here
implementation 'io.dyte:uikit:1.2.0'
- 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" />
If you intend to publish your app to the Google Play, you'll need to perform a few additional steps. So if you’re working on release builds and not debug builds, refer to the Release Builds section.
Step 2: 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 meetingInfo = = DyteMeetingInfoV2(
authToken = state.authToken,
)
val config = DyteUIKitConfig(
activity = this,
dyteMeetingInfo = meetingInfo
)
val dyteClient = DyteUIKitBuilder.build(config)
You need to create
Step 3: Configure a Dyte meeting
Set the properties in the DyteMeetingInfoV2
class. You just need to provide
the participant's authToken
.
Name | Description |
---|---|
authToken | After 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 4: Launch the meeting UI
To lanuch the meeting UI all you need to do is call loadUi()
which will take
care of everything for you.
dyteClient.loadUi()
Here is a pictorial representation of all the config options defined below.
For Android release builds
If you intend to publish your app to the Google Play, perform the following steps after installing the SDKs. So if you’re working on release builds and not debug builds, do the following:
Perform the following steps, for Android release builds:
- 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.** { *; }
- Add the following to your
android/app/build.gradle
to import the proguard configuration.
buildTypes {
release {
...
...
...
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}