Updated on 2024-07-30 GMT+08:00

Initializing the SDK Synchronously

Init

Initializing the SDK synchronously

1
HWMSdk.init(Application,OpenSDKConfig)

API Description

This API is used to initialize the SDK and prepare the environment. It must be called prior to other APIs. It needs to be called only once. You are advised to call this API in onCreate of the application. Call this API as early as possible so that the SDK can obtain the current activity and jump to a specified page by listening to the activity lifecycle.

Precautions

1. Initializing the API takes about 1 to 2 seconds. If you have requirements on the initialization speed, use the asynchronous initialization API.

2. Pass the correct Application and OpenSDKConfig objects.

3. If you do not want to call this API in onCreate of the application, set openSDKConfig.setInitOnAppStart(false).

Method Definition

1
2
3
4
5
6
 /**
     * Initializes the SDK.
     * @param application Indicates the application object.
     * @param sdkConfig Indicates the SDK configuration object.
     */
void init(@NonNull Application application, OpenSDKConfig sdkConfig);

Parameter Description

Table 1 Parameter description

Parameter

Mandatory

Type

Description

application

Yes

Application

Application object.

sdkConfig

Yes

OpenSDKConfig

SDK configuration object.

Table 2 Initialization information OpenSDKConfig

Parameter

Mandatory

Type

Description

appId

Yes

String

App ID. You need to request an app ID. For details, see Introduction to App ID Authentication in Developer Guide.

serverAddress

No

String

Server address.

serverPort

No

String

Server port.

needConfChat

No

Boolean

Whether the in-meeting chat function is required.

logKeepDays

No

Integer

Log storage duration. Valid value range is 3–30. The default value is 0. 0 indicates that logs are not deleted by day.

Note: 1 and 2 will be converted to 3, and the values greater than 30 will be converted to 30.

isDisableIncomingNotification

No

Boolean

Whether to disable automatic display of the notification when an incoming call is received.

isSupportMultiAppLogin

No

Boolean

Whether to support login to multiple applications on the same device.

Sample Code

OpenSDKConfig sdkConfig = new OpenSDKConfig(this)        
         .setAppId(getAppId()) 
// Request an app ID. For details, see Requesting an App ID.
HWMSdk.init(this,sdkConfig);