# Video SDK UI Toolkit 2.0 for Android

<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->

> Zoom Video SDK UI Toolkit is in a public beta. [Share your feedback](https://zoom.sjc1.qualtrics.com/jfe/form/SV_3NMYztWpWzNVSiG) with us, and leverage the [beta FAQ](#beta-faq) for details.

## Get started

### Prerequisites

-   Android Studio and Gradle.
-   Use the `minSdk` published with the Video SDK or toolkit build you consume.
-   `us.zoom.videosdk:zoomvideosdk-core` as an app dependency`
-   Optional - `us.zoom.videosdk:zoomvideosdk-videoeffects`, same version as `zoomvideosdk-core`. Not transitive; needed for VB blur/image.
-   A trusted backend that issues short-lived session tokens. Do not mint tokens in the client for production.
-   A (Video SDK developer account)[/docs/video-sdk/developer-accounts/].

Add the required permissions in `AndroidManifest.xml`.

-   CAMERA - local camera video
-   RECORD_AUDIO - microphone and share audio capture
-   INTERNET
-   FOREGROUND_SERVICE and FOREGROUND_SERVICE_MEDIA_PROJECTION - Android 14+ screen share
-   FOREGROUND_SERVICE_MEDIA_PLAYBACK / MICROPHONE / CONNECTED_DEVICE - as required by the share foreground-service types
-   POST_NOTIFICATIONS - Android 13+ share notification

Request camera and microphone at runtime before showing media buttons. The toolkit does not request permissions.

## Initialize and attach

Initialize the Video SDK, then attach the toolkit once in `Application.onCreate`. Do not use `ZMUIToolKitInitParams` as that API is not in the current toolkit.

```kotlin
class MyApp : Application() {
    override fun onCreate() {
        super.onCreate()
        val sdkParams = ZoomVideoSDKInitParams().apply {
            domain = "zoom.us"
            enableLog = true
        }
        ZoomVideoSDK.getInstance().initialize(this, sdkParams)
        ZMUIToolKitManager.sharedInstance().attach(this, ZoomVideoSDK.getInstance())
    }
}
```

`attach()` must run before any toolkit view is inflated. If you call `ZMUIToolKitManager.cleanup()` (the sample does this when MainActivity finishes), call `attach()` again before the next toolkit screen, and call `cleanup()` after `super.onDestroy()`.

## Join a session

Join is the host app's responsibility. Build `ZoomVideoSDKSessionContext` and call `ZMUIToolKitManager.sdk.joinSession(...)`. There is no `ZMUIToolKitJoinSessionParams` in the current toolkit.

```kotlin
val sessionContext = ZoomVideoSDKSessionContext().apply {
    sessionName = sessionName
    userName = displayName
    token = tokenFromServer
    if (sessionPassword.isNotEmpty()) this.sessionPassword = sessionPassword
    videoOption = ZoomVideoSDKVideoOption().apply { localVideoOn = true }
    audioOption = ZoomVideoSDKAudioOption().apply { connect = true; mute = false }
}
ZMUIToolKitManager.sdk.joinSession(sessionContext)
```

## Session events

Implement `ZoomVideoSDKDelegate` and register it on `ZoomVideoSDK`. Do not call `ZMUIToolKitManager.addDelegate` as that API is not public.

```kotlin
class MainActivity : AppCompatActivity(), ZoomVideoSDKDelegate {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        ZoomVideoSDK.getInstance().addListener(this)
    }
    override fun onDestroy() {
        ZoomVideoSDK.getInstance().removeListener(this)
        super.onDestroy()
    }
    override fun onSessionJoin() { /* show in-session UI */ }
    override fun onSessionLeave(reason: ZoomVideoSDKSessionLeaveReason?) { /* leave join screen */ }
}
```

Query state with `ZMUIToolKitManager.sharedInstance().isInSession()` and `ZMUIToolKitManager.sdk.session (sessionName, sessionID, mySelf, remoteUsers)`. Leave with `ZMUIToolKitManager.sharedInstance().leaveSession(end = false)`.

## UI components

Drop-in `MaterialButton` or `FrameLayout` widgets

-   `ZMUIToolKitAudioBtn` / `ZMUIToolKitVideoBtn` - mute and camera.
-   `ZMUIToolKitShareBtn` - starts share after you forward onActivityResult.
-   `ZMUIToolKitPauseShareBtn` - pause/resume while the local user is sharing.
-   `ZMUIToolKitParticipantsBtn` - participant list and host actions.
-   `ZMUIToolKitMoreBtn` - overflow sheet. This is customizable.
-   `ZMUIToolKitChatBtn` - dedicated chat button with unread badge.
-   `ZMUIToolKitLeaveBtn` - leave or end session.
-   `ZMUIToolKitSwitchCameraBtn` - front and rear camera. Hides itself if the device has fewer than two cameras.
-   `ZMUIToolKitVirtualBackgroundBtn` - VB picker. Also reachable from **More** when supported.
-   `ZMUIToolkitVideoPage` - speaker / gallery / share / PiP surface.

Keep toolkit buttons `android:visibility="gone"` until `ZoomVideoSDKDelegate.onSessionJoin`, then set `View.VISIBLE`. Most buttons wire icon and click once on first visible. Showing them before `session.mySelf` exists leaves them unresponsive for the rest of the session.

```xml
<us.zoom.uitoolkit.ZMUIToolKitAudioBtn
    android:id="@+id/audioBtn"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:visibility="gone"
/>
<!-- same gone visibility for video, share, more, participants, leave, switchCamera, chat -->
```

```kotlin
override fun onSessionJoin() {
    binding.audioBtn.visibility = View.VISIBLE
    binding.videoBtn.visibility = View.VISIBLE
    binding.shareBtn.visibility = View.VISIBLE
    binding.moreBtn.visibility = View.VISIBLE
    binding.leaveBtn.visibility = View.VISIBLE
    binding.switchCameraBtn.visibility = View.VISIBLE
}
```

### More menu (`ZMUIToolKitMoreBtn`)

Default included set is `ZMUIToolKitMoreMenuItems.ALL`: Chat, Virtual background, Recording, Share pause/resume, Settings. `Cancel` is always present and is not a flag. An item appears only if it was included AND its live gate passes (VB `isSupported`, recording `canControlRecording`, share `isSharing`). Settings contents: My Name (rename), Video (PiP), Statistics. There is no **Allow all participants to chat** toggle (iOS Settings does not have it either).

Combine flags with `or`, not `and`. CHAT or SETTINGS keeps those two. CHAT and SETTINGS is `0` and shows only `Cancel`. To drop Chat when you already have `ZMUIToolKitChatBtn`: ALL and CHAT.inv().

```kotlin
moreBtn.setIncludedItems(
    ZMUIToolKitMoreMenuItems.CHAT or ZMUIToolKitMoreMenuItems.SETTINGS
)
// Omit Chat from More:
moreBtn.setIncludedItems(
    ZMUIToolKitMoreMenuItems.ALL and ZMUIToolKitMoreMenuItems.CHAT.inv()
)
```

```xml
<us.zoom.uitoolkit.ZMUIToolKitMoreBtn
    android:id="@+id/moreBtn"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    app:zmIncludedMoreItems="virtualBackground|recording|share|settings"
/>
```

Flags: CHAT (1), VIRTUAL_BACKGROUND (2), RECORDING (4), SHARE (8), SETTINGS (16), ALL (31). Android item order is VB → Settings → Chat → recording → share (iOS is Chat-first).

### Chat

`ZMUIToolKitChatBtn` opens the same chat sheet as the **More** Chat row. Unread badge is on the dedicated chat button. Session chat is in-memory for the current session only. Hosts that put `ChatBtn` on the toolbar should omit CHAT from **More**.

```xml
<us.zoom.uitoolkit.ZMUIToolKitChatBtn
    android:id="@+id/chatBtn"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:visibility="gone"
/>
```

```kotlin
binding.chatBtn.visibility = View.VISIBLE
binding.moreBtn.setIncludedItems( ZMUIToolKitMoreMenuItems.ALL and ZMUIToolKitMoreMenuItems.CHAT.inv() )
```

### Virtual background

Add `zoomvideosdk-videoeffects` using the same version as your `zoomvideosdk-core` dependency. The toolkit compiles against it as compileOnly, so it is not pulled in transitively. Without it, `isSupported` stays false and the **More** VB row is hidden. The VB picker preview can show a switch-camera overlay when local video is on and the device has more than one camera.

// Same version as zoomvideosdk-core - do not pin a toolkit-specific version here. implementation "us.zoom.videosdk:zoomvideosdk-videoeffects:$zoomVideoSdkVersion"

```xml
<us.zoom.uitoolkit.ZMUIToolKitVirtualBackgroundBtn
    android:id="@+id/virtualBackgroundBtn"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:visibility="gone"
/>
```

### Switch camera

`ZMUIToolKitSwitchCameraBtn` calls `switchCamera()` then `rotateMyVideo(display.rotation)`. It hides itself when `getNumberOfCameras()` is less than or equal to 1. Keep it gone until `onSessionJoin` like other toolbar buttons.

```xml
<us.zoom.uitoolkit.ZMUIToolKitSwitchCameraBtn
    android:id="@+id/switchCameraBtn"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:visibility="gone"
/>
```

### Share

Tapping `ZMUIToolKitShareBtn` does not start share by itself. Forward the media-projection result.

```kotlin
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
    super.onActivityResult(requestCode, resultCode, data)
    if (requestCode == ZMUIToolKitManager.REQUEST_SHARE_SCREEN_PERMISSION &&
        resultCode == RESULT_OK && data != null) {
        ZMUIToolKitManager.sharedInstance()
            .startShareScreen(this, data, MainActivity::class.java)
    }
}
```

While sharing, `ZMUIToolKitPauseShareBtn` and the **More** SHARE items pause and resume through `ZMUIToolKitShareManager`.

```xml
<us.zoom.uitoolkit.ZMUIToolKitPauseShareBtn
    android:id="@+id/pauseShareBtn"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:visibility="gone"
/>
```

### Recording

Cloud recording controls live on the More sheet when RECORDING is included and `ZMUIToolKitRecordingManager.canControlRecording` is `true`. Start or stop use confirmation dialogs, while pause or resume run immediately. The recording manager owns participant consent.

### Localization

Override `zm_ui_toolkit_`\* keys in the host app's `values-<locale>/strings.xml`. The live list is `uitoolkit/src/main/res/values/strings.xml`. Prefix `zm_ui_toolkit_` not `zm_uitoolkit_`.

```xml
<!-- host app: res/values-zh-rCN/strings.xml -->
<resources>
    <string name="zm_ui_toolkit_more">更多</string>
    <string name="zm_ui_toolkit_chat">聊天</string>
    <string name="zm_ui_toolkit_settings">设置</string>
</resources>
```

### Participants

`ZMUIToolKitParticipantsBtn` opens a searchable participant list and shows a live count badge.

-   Anyone can rename themselves. The host can rename any participant.
-   On another participant, the host can mute that person when their audio is connected and not already muted, make them host, make them co-host (`makeManager`), or remove them. Remove asks for confirmation.
-   The host also gets a **Mute all** button. It calls `muteAllAudio(true)`.
-   Rows are tagged `Host` or `Co-host` when those roles apply.

### Chat recipients

The chat sheet sends to Everyone or to one participant (`sendChatToUser`). Opening the sheet clears the unread badge on `ZMUIToolKitChatBtn`. Messages are kept in memory for the current session only.

### Video page

`ZMUIToolkitVideoPage` lays out speaker view, the gallery, remote share, and a self picture-in-picture tile that can be dragged inside the page. A page indicator appears when there is more than one page.

-   On the remote share page, pinch to zoom up to 5x. Double-tap resets the zoom.
-   Pause and resume do not rebuild the page. The existing share canvas stays subscribed.
-   A top-left REC badge is red while cloud recording is active and grey while it is paused.

### Leave

`ZMUIToolKitLeaveBtn` is role-aware.

-   A non-host leaves only themselves: `leaveSession(false)`.
-   A host who leaves while other people are still in the session assigns a new host first, then leaves.
-   End for all calls `leaveSession(true)` after a confirmation dialog.

Cloud-recording consent is shown by `ZMUIToolKitRecordingManager`. Got it accepts the recording. Leave meeting declines it and leaves the session. Do not ask me again suppresses further prompts until the session ends.

## Suggested production checklist

-   Use backend-issued short-lived tokens, and never ship SDK secrets
-   Handle camera / mic / share permission denial
-   Keep toolkit buttons gone until `onSessionJoin`
-   Remove `ZoomVideoSDKDelegate` in `onDestroy`
-   Forward onActivityResult for screen share
-   Add video effects only if you need virtual backgrounds
