提交工单
咨询集成、功能及报价等问题
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.
Upgrade the SDK to V2.0.0 or later using the Android Studio.
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);
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();