getLoginStatus
Feature Introduction
Description
Retrieve user login status. If this interface is called without initializing the SDK, it will return -1001 (Uninitialized).
Note
Note the difference between connection status and login status. Only call login
when not logged in.
- iOS
- Android
- Flutter
- uni-app
- Browser/Electron/MiniProgram
- React-Native
- Unity
Function Prototype
Future<int?> getLoginStatus()
Input Parameters
None
Return Value
Parameter Name | Type | Description |
---|---|---|
~ | int | Login status, 1: Not logged in 2: Logging in 3: Logged in |
Code Example
int? status = await OpenIM.iMManager.getLoginStatus();
Function Prototype
- (OIMLoginStatus)getLoginStatus;
Input Parameters
None
Return Value
Parameter Name | Type | Description |
---|---|---|
status | OIMLoginStatus | Login status, 1: Not logged in 2: Logging in 3: Logged in |
Code Example
OIMLoginStatus status = [OIMManager.manager getLoginStatus];
Function Prototype
public int getLoginStatus()
Return Value
Parameter Name | Type | Description |
---|---|---|
~ | int | LoginStatus Login status |
Code Example
int status = OpenIMClient.getInstance().getLoginStatus();
Function Prototype
IMSDK.getLoginStatus(operationID?:string): Promise<WsResponse<LoginStatus>>;
Input Parameters
None
Return Value
Parameter Name | Type | Description |
---|---|---|
Promise.then() | Promise<WsResponse<LoginStatus>> | Login status |
Promise.catch() | Promise<WsResponse> | Callback for call failure |
Code Example
import { getSDK } from '@openim/wasm-client-sdk';
const IMSDK = getSDK();
// use in electron with ffi
// import { getWithRenderProcess } from '@openim/electron-client-sdk/lib/render';
// const { instance: IMSDK } = getWithRenderProcess();
// use in mini program
// import { getSDK } from '@openim/client-sdk';
// const IMSDK = getSDK();
IMSDK.getLoginStatus()
.then(({ data }) => {
// data: LoginStatus
})
.catch(({ errCode, errMsg }) => {
// Call failed
});
Function Prototype
IMSDK.asyncApi('getLoginStatus',operationID: string): Promise<LoginStatus>;
Input Parameters
None
Return Value
Parameter Name | Type | Description |
---|---|---|
Promise.then() | Promise<LoginStatus> | Current user login status |
Promise.catch() | Promise<CatchResponse> | Callback for call failure |
Code Example
import IMSDK from 'openim-uniapp-polyfill';
IMSDK.asyncApi('getLoginStatus', 'operationID')
.then((data) => {
// data: LoginStatus
})
.catch(({ errCode, errMsg }) => {
// Call failed
});
Function Prototype
OpenIMSDKRN.getLoginStatus(operationID: string): Promise<LoginStatus>
Input Parameters
Parameter Name | Parameter Type | Description |
---|---|---|
operationID | string | Operation ID, used for problem location, keep unique, suggest using current time and random number |
Return Result
Parameter Name | Parameter Type | Description |
---|---|---|
Promise.then() | Promise<LoginStatus> | Current user login status |
Promise.catch() | Promise<CatchResponse> | Callback on failed call |
Code Example
import OpenIMSDKRN from "open-im-sdk-rn";
OpenIMSDKRN.getLoginStatus("operationID");
.then((data) => {
// data: LoginStatus
})
.catch(({ errCode, errMsg }) => {
// Call failed
});