Quick start
2026-01-23
Prepare the environment
Before you attempt to integrate the SDK, make sure that the development environment meets the following requirements:
- Android Studio 2021.1.1 or a higher version.
- Android SDK 25, Android SDK Build-Tools 25.0.2, and Android SDK Platform-Tools 25.x.x or higher versions.
- An Android device running Android 4.4 or higher that supports audio and video.
- The Android device is connected to the Internet.
Integrate the SDK
Add ZegoUIKitPrebuiltLiveStreaming as dependencies
- Add the
jitpackconfiguration.
- If your Android Gradle Plugin is 7.1.0 or later: enter your project's root directory, open the
settings.gradlefile to add the jitpack todependencyResolutionManagement>repositorieslike this:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
maven { url 'https://maven.zego.im' } // <- Add this line.
maven { url 'https://www.jitpack.io' } // <- Add this line.
}
}Warning
If you can't find the above fields in settings.gradle, it's probably because your Android Gradle Plugin version is lower than v7.1.0.
For more details, see Android Gradle Plugin Release Note v7.1.0.
- If your Android Gradle Plugin is earlier than 7.1.0: enter your project's root directory, open the
build.gradlefile to add the jitpack toallprojects->repositorieslike this:
allprojects {
repositories {
google()
mavenCentral()
maven { url 'https://maven.zego.im' } // <- Add this line.
maven { url "https://jitpack.io" } // <- Add this line.
}
}- Modify your app-level
build.gradlefile:
dependencies {
...
implementation 'im.zego:zego_uikit_prebuilt_live_streaming_android:+' // Add this line to your module-level build.gradle file's dependencies, usually named [app].
}Using the ZegoUIKitPrebuiltLiveStreamingFragment in your project
- Go to ZEGOCLOUD Admin Console, get the
appIDandappSignof your project. - Specify the
userIDanduserNamefor connecting the Live Streaming Kit service. liveIDrepresents the live streaming you want to start or watch (only supports single-host live streaming for now).
Note
userID,userName, andliveIDcan only contain numbers, letters, and underlines (_).- Using the same
liveIDwill enter the same live streaming.
Warning
With the same liveID, only one user can enter the live stream as host. Other users need to enter the live stream as the audience.
public class LiveActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_call);
addFragment();
}
public void addFragment() {
long appID = yourAppID;
String appSign = yourAppSign;
String userID = yourUserID;
String userName = yourUserName;
boolean isHost = getIntent().getBooleanExtra("host", false);
String liveID = getIntent().getStringExtra("liveID");
ZegoUIKitPrebuiltLiveStreamingConfig config;
if (isHost) {
config = ZegoUIKitPrebuiltLiveStreamingConfig.host();
} else {
config = ZegoUIKitPrebuiltLiveStreamingConfig.audience();
}
ZegoUIKitPrebuiltLiveStreamingFragment fragment = ZegoUIKitPrebuiltCallFragment.newInstance(
appID, appSign, userID, userName,liveID,config);
getSupportFragmentManager().beginTransaction()
.replace(R.id.fragment_container, fragment)
.commitNow();
}
}Then, you can start live streaming by starting your LiveActivity.
Run & Test
Now you have finished all the steps!
You can simply click the Run on Android Studio to run and test your App on the device.
Resources
Sample code
Click here to get the complete sample code.
