Quick start
Prepare the environment
Before you attempt to integrate the SDK, make sure that the development environment meets the following requirements:
- Android Studio 2020.3.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
1
Add ZegoUIKitPrebuiltCall as dependencies
- Add the
jitpack
configuration
- Modify your app-level
build.gradle
file
Untitled
dependencies {
...
implementation 'com.github.ZEGOCLOUD:zego_uikit_prebuilt_call_android:+' // add this line in your module-level build.gradle file's dependencies, usually named [app].
}
1
2
Using the ZegoUIKitPrebuiltCallFragment in your project
- Go to ZEGOCLOUD Admin Console, get the
appID
andappSign
of your project. - Specify the
userID
anduserName
for connecting the Call Kit service. - Create a
callID
that represents the call you want to make.
Note
userID
andcallID
can only contain numbers, letters, and underlines (_).- Users that join the call with the same
callID
can talk to each other.
Java
Kotlin
public class CallActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_call);
addCallFragment();
}
public void addCallFragment() {
long appID = yourAppID;
String appSign = yourAppSign;
String callID = callID;
String userID = userID;
String userName = userName;
// You can also use GroupVideo/GroupVoice/OneOnOneVoice to make more types of calls.
ZegoUIKitPrebuiltCallConfig config = ZegoUIKitPrebuiltCallConfig.oneOnOneVideoCall();
ZegoUIKitPrebuiltCallFragment fragment = ZegoUIKitPrebuiltCallFragment.newInstance(
appID, appSign, userID, userName, callID, config);
getSupportFragmentManager().beginTransaction()
.replace(R.id.fragment_container, fragment)
.commitNow();
}
}
1
class CallActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_call)
addCallFragment()
}
private fun addCallFragment() {
val appID: Long = yourAppID
val appSign: String = yourAppSign
val callID: String = callID
val userID: String = userID
val userName: String = userName
// You can also use GroupVideo/GroupVoice/OneOnOneVoice to make more types of calls.
val config = ZegoUIKitPrebuiltCallConfig.oneOnOneVideoCall()
val fragment = ZegoUIKitPrebuiltCallFragment.newInstance(
appID, appSign, userID, userName, callID, config
)
supportFragmentManager.beginTransaction()
.replace(R.id.fragment_container, fragment)
.commitNow()
}
}
1
Modify the auto-created activity_call.xml
file:
Untitled
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/fragment_container"
android:layout_width="match_parent"
android:layout_height="match_parent">
</androidx.constraintlayout.widget.ConstraintLayout>
1
Now, you can make a new call by starting your CallActivity
.
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 your device.
Related guide
Custom prebuilt UI
Resources
Sample Code
Click here to get the complete sample code.