unInitSDK
Introduction
Uninitialized the SDK.
Generally, if your application's lifecycle is the same as the IM SDK's lifecycle, you don't need to reinitialize the IM SDK before exiting the application.
However, you can reinitialize the IM SDK in special cases, for example, only after you enter a specific UI and no longer use it after exiting the UI.
Parameter details
This API has no parameters
Returned template
V2TimCallback
{
code : number
desc : string
}
Return value details
name | type | description |
---|---|---|
code | number | Request result: Error codes. 0 means success. |
desc | string | The description of the error. It will be empty if success. |
Code example
import {
TencentImSDKPlugin,
LogLevelEnum,
V2TimSDKListener,
} from 'react-native-tim-js';
const sdkAppID = 0;
const sdkListener: V2TimSDKListener = {
onConnectFailed: (code, error) => {
},
onConnectSuccess: () => {
},
onConnecting: () => {
},
onKickedOffline: () => {
},
onSelfInfoUpdated: (info) => {
},
onUserSigExpired: () => {
},
onUserStatusChanged: (userStatusList) => {
},
};
const initSDKRes = await TencentImSDKPlugin.v2TIMManager.initSDK(
sdkAppID,
LogLevelEnum.V2TIM_LOG_DEBUG,
sdkListener
);
if (initSDKRes.code === 0) {
}
const unInitSDKRes = await TencentImSDKPlugin.v2TIMManager.unInitSDK();
if (unInitSDKRes.code === 0) {
}