products / solutions
Platform / Framework

How to upgrade UIKits with a plugin to V2.0.0?

Products / Plugins:Call Kit / Live Streaming Kit

Platform / Framework:Android

Last updated:2023-02-09 18:24

This article introduces how to update the UIKits with the plugin (ZegoUIKitSignalingPlugin) from V1.x.x to V2.0.0.

  • This article is only for users who use UIKits with plugins. If you are using UIKits without plugins, you can simply update your UIKits to the latest version.
  • Apart from the UIKits mentioned in this article, other UIKits don't require you to do anything else to upgrade.

Call Kit (ZegoUIKitPrebuiltCall)

  1. Upgrade the SDK to V2.0.0 or later using the Android Studio.

  2. Modify part of the code.

Change the code used to initialize the SDK.

If your project used ZegoUIKitPrebuiltCallInvitationConfig class, then the code used for initialization needs to delete the first parameter.

// Version 1.x.x
ZegoUIKitPrebuiltCallInvitationConfig callInvitationConfig = new ZegoUIKitPrebuiltCallInvitationConfig(ZegoSignalingPlugin.getInstance());
callInvitationConfig.notifyWhenAppRunningInBackgroundOrQuit = false;
ZegoUIKitPrebuiltCallInvitationService.init(getApplication(), appID, appSign, userID, userName, callInvitationConfig);

// Version 2.0.0 
ZegoUIKitPrebuiltCallInvitationConfig callInvitationConfig = new ZegoUIKitPrebuiltCallInvitationConfig();
callInvitationConfig.notifyWhenAppRunningInBackgroundOrQuit = false;
ZegoUIKitPrebuiltCallInvitationService.init(getApplication(), appID, appSign, userID, userName, callInvitationConfig);

Live Streaming Kit (ZegoUIKitPrebuiltLiveStreaming)

  1. Upgrade the SDK to V2.0.0 or later using the Android Studio.
  1. Modify part of the code.

Change the code used to initialize the SDK.

// Version 1.x.x
List<IZegoUIKitPlugin> plugins = Collections.singletonList(ZegoSignalingPlugin.getInstance());
ZegoUIKitPrebuiltLiveStreamingConfig config;
if (isHost) {
    config = ZegoUIKitPrebuiltLiveStreamingConfig.host(plugins);
} else {
    config = ZegoUIKitPrebuiltLiveStreamingConfig.audience(plugins);
}
ZegoUIKitPrebuiltLiveStreamingFragment fragment = ZegoUIKitPrebuiltLiveStreamingFragment.newInstance(appID,
    appSign, userID, userName, liveID, config);
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, fragment).commitNow();

// Version 2.0.0 
ZegoUIKitPrebuiltLiveStreamingConfig config;
if (isHost) {
    config = ZegoUIKitPrebuiltLiveStreamingConfig.host(true);
} else {
    config = ZegoUIKitPrebuiltLiveStreamingConfig.audience(true);
}
ZegoUIKitPrebuiltLiveStreamingFragment fragment = ZegoUIKitPrebuiltLiveStreamingFragment.newInstance(appID,appSign, userID, userName, liveID, config);
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, fragment).commitNow();
Page Directory
Download PDF