init

public static void init(Context context)

Initializes the SDK. This should be called only once globally within the application. It is recommended to call this method in the Application subclass.

Since

5.0.0

Deprecated

This method is deprecated. Please use init instead.

Parameters

context

The Context of the Application class.

Throws

IllegalArgumentException

Thrown when the parameter is invalid.


public static void init(Context context, String appKey)

Initializes the SDK. This should be called only once globally within the application, preferably in the Application subclass.

Since

5.0.0

Deprecated

This method is deprecated. Please use init instead.

Parameters

context

The Context of the Application class.

appKey

The App Key obtained after creating an application on the RCdeveloper platform.

This parameter is optional. If not provided, the SDK will use the RONG_CLOUD_APP_KEY configured in the AndroidManifest.xml.<meta-data android:name=RONG_CLOUD_APP_KEY android:value=****** />

Throws

IllegalArgumentException

Thrown when the parameters are invalid.


public static void init(Context context, String appKey, boolean enablePush)

Initializes the SDK. This method should be called only once globally in the application, preferably in the Application subclass.

Since

5.0.0

Deprecated

This method is deprecated. Please use init instead.

Parameters

context

The Context of the Application class.

appKey

The App Key obtained after creating an application on the RCdeveloper platform.

This parameter is optional. If not provided, the SDK will use the RONG_CLOUD_APP_KEY configured in AndroidManifest.xml.<meta-data android:name=RONG_CLOUD_APP_KEY android:value=****** />

enablePush

Specifies whether to enable push notification. true to enable; false to disable.

Throws

IllegalArgumentException

Thrown if the parameters are invalid.


public static void init(Context context, String appKey, boolean enablePush, Boolean isMainProcess)

Initializes the SDK. This should be called only once globally in the application. It is recommended to call this in the Application inherited class.

Since

5.1.3

Deprecated

This method is deprecated. Please use init

Parameters

context

The Context of the Application class.

appKey

The App Key obtained after creating an application on the RCDeveloper Platform.

This parameter is optional. If no value is passed, the SDK will use the RONG_CLOUD_APP_KEY configured in the AndroidManifest.xml.<meta-data android:name=RONG_CLOUD_APP_KEY android:value=****** />

enablePush

Whether to enable push notifications. true to enable push; false to disable push.

Throws

IllegalArgumentException

Thrown if the parameters are invalid.


public static void init(Context context, String appKey, InitOption option)

Initializes the SDK. This should be called only once globally in the application.

Since

5.3.4

Parameters

context

The Context of the Application class.

appKey

The App Key obtained after creating an application on the RCdeveloper platform.

This parameter is optional. If not provided, the SDK will use the RONG_CLOUD_APP_KEY configured in the AndroidManifest.xml.* <meta-data android:name=RONG_CLOUD_APP_KEY android:value=****** />

option

The configuration information required for initialization. For details, refer to InitOption