Updated on 2023-03-27 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 and placed in onCreate of Application. It must be called 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.

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 Parameters

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.

Sample Code

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