Call Kit
  • iOS
  • Android : Java
  • Web
  • Flutter
  • React Native
  • Overview
  • Quick start
    • Quick start
    • Quick start (with call invitation)
  • Customize the call
    • Overview
    • Set avatar for users
    • Add custom components to the call
    • Configure layouts
    • Hide the label on the user view
    • Implement an audio-only call
    • Customize the menu bar
    • Set a hangup confirmation dialog
    • Call invitation config
    • Calculate call duration
  • Enhance the call
    • Screen sharing
    • Minimize video call window
    • Advanced beauty effects
    • Use Tokens for authentication
  • Troubleshooting call invitations
  • FAQ
  • API Reference
    • API
    • Event
    • Config
  • Migration guide
  • Documentation
  • Call Kit
  • Quick start
  • Quick start

Quick start

Last updated:2023-09-13 10:34

Integrate the SDK

Add ZegoUIKitPrebuiltCall as dependencies

  1. Add the jitpack configuration.
  • If your Android Gradle Plugin is 7.1.0 or later: enter your project's root directory, open the settings.gradle file to add the jitpack to dependencyResolutionManagement > repositories like this:
dependencyResolutionManagement {
   repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
   repositories {
      google()
      mavenCentral()
      maven { url 'https://storage.zego.im/maven' }   // <- Add this line.
      maven { url 'https://www.jitpack.io' } // <- Add this line.
   }
}

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.gradle file to add the jitpack to allprojects->repositories like this:
allprojects {
    repositories {
        google()
        mavenCentral()
        maven { url 'https://storage.zego.im/maven' }   // <- Add this line.
        maven { url "https://jitpack.io" }  // <- Add this line.
    }
}
  1. Modify your app-level build.gradle file:
    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].
    }

Using the ZegoUIKitPrebuiltCallFragment in your project

  • Go to ZEGOCLOUD Admin Console, get the appID and appSign of your project.
  • Specify the userID and userName for connecting the Call Kit service.
  • Create a callID that represents the call you want to make.
  • userID and callID 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, callID, userID, userName,config);

        getSupportFragmentManager().beginTransaction()
            .replace(R.id.fragment_container, fragment)
            .commitNow();
    }
}
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, callID, userID, userName, config
        )
        supportFragmentManager.beginTransaction()
            .replace(R.id.fragment_container, fragment)
            .commitNow()
    }
}

Modify the auto-created activity_call.xml file:

<?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>

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.

Customize prebuilt UI

Resources

Page Directory