public class NIMClient
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
TAG |
Constructor and Description |
---|
NIMClient() |
Modifier and Type | Method and Description |
---|---|
static void |
config(Context context,
LoginInfo info,
SDKOptions options)
[Method 2] Configures the SDK in
Application#onCreate() . |
static ModeCode |
getMode()
Gets the current login mode of the SDK
|
static java.lang.String |
getSdkStorageDirPath()
Gets the data directory path in the SDK.
|
static java.lang.String |
getSDKVersion()
Gets the version number of the SDK.
|
static <T> T |
getService(java.lang.Class<T> clazz)
Gets interfaces for each service.
|
static StatusCode |
getStatus()
Gets the state of the current user.
|
static void |
init(Context context,
LoginInfo info,
SDKOptions options)
[Method 1] Initializes SDK using
Application#onCreate() |
static void |
initSDK()
[Method 2] initializes the SDK when required on the main thread of the UI process instead of being initialized by calling
Application#onCreate() ). |
static <T> RequestResult<T> |
syncRequest(InvocationFuture<T> future) |
static <T> RequestResult<T> |
syncRequest(InvocationFuture<T> future,
long time)
Converts an asynchronous call into a synchronous call when making asynchronous API calls on a non-UI thread.
|
static void |
toggleNotification(boolean on)
Turns on or off alerts on the notifications bar.
|
static void |
toggleRevokeMessageNotification(boolean on)
Turns on or off alerts when message are recalled.
|
static void |
updateCaptureDeviceInfoOption(CaptureDeviceInfoConfig captureDeviceInfoConfig)
Updates the configuration for getting the device information
A value of null indicates the device information can be obtained.
|
static void |
updateStatusBarNotificationConfig(StatusBarNotificationConfig config)
Updates the configuration of the notification alert on the status bar
|
static void |
updateStrings(NimStrings strings)
Updates the strings when the system language changes.
|
static void |
updateTokenSceneConfig(NosTokenSceneConfig config)
Updates NosTokenSceneConfig
|
public static final java.lang.String TAG
public static void init(Context context, LoginInfo info, SDKOptions options)
Application#onCreate()
context
- specifies the context parameter.info
- User info. If the user information is provided, automatic login will be implemented and the user info will be fetched at the same time. If no user account is logged in, pass in null.options
- specifies the SDK configuration.public static void config(Context context, LoginInfo info, SDKOptions options)
Application#onCreate()
.context
- specifies the context parameter.info
- User info. If the user information is provided, automatic login will be implemented and the user info will be fetched at the same time. If no user account is logged in, pass in null.options
- specifies the SDK configuration.public static void initSDK()
Application#onCreate()
).
Synchronous and asynchronous calls are supported using SDKOptions.asyncInitSDK
Weak IM mode is supported by calling SDKOptions.reducedIM
, and loading the push process service is delayed.
Note: Call config(Context, LoginInfo, SDKOptions)
in Application#onCreate()
first.public static <T> T getService(java.lang.Class<T> clazz)
T
- service interface typeclazz
- service interface class instancepublic static <T> RequestResult<T> syncRequest(InvocationFuture<T> future, long time)
ResponseCode.RES_API_SYNC_RUN_ON_LOOPER_THREAD_EXCEPTION
T
- The data type of the resultfuture
- The callback returned by the asynchronous API calltime
- The maximum waiting time for synchronization in milliseconds. In most cases, set the value to 30000. after the timeout, the method returns the error code ResponseCode.RES_API_SYNC_TIMEOUT
public static <T> RequestResult<T> syncRequest(InvocationFuture<T> future)
public static StatusCode getStatus()
public static ModeCode getMode()
public static void toggleNotification(boolean on)
on
- Option to turn on or offpublic static void toggleRevokeMessageNotification(boolean on)
toggleNotification(boolean on)
becomes invalid.on
- Option to turn on or offpublic static void updateStatusBarNotificationConfig(StatusBarNotificationConfig config)
config
- The configurationpublic static void updateStrings(NimStrings strings)
strings
- Definition of strings used in SDK.public static java.lang.String getSdkStorageDirPath()
public static java.lang.String getSDKVersion()
public static void updateTokenSceneConfig(NosTokenSceneConfig config)
config
- NosTokenSceneConfigpublic static void updateCaptureDeviceInfoOption(CaptureDeviceInfoConfig captureDeviceInfoConfig)
captureDeviceInfoConfig
- The configuration for getting the device information