Skip to main content

setAppBackgroundStatus

Function Introduction

Description

Set whether the application is running in the background. Call when the application switches between foreground and background status.

Function Prototype

IMSDK.asyncApi('setAppBackgroundStatus', operationID: string, isBackgroud: boolean): Promise<void>

Input Parameters

Parameter NameParameter TypeRequiredDescription
operationIDstringYesOperation ID, used for problem tracking. Recommended to use the current time combined with a random number
isBackgroudbooleanYesWhether the application is running in the background

Return Results

The function is Promise-ified using the openim-uniapp-polyfill package. When calling, use then and catch to judge and handle success and failure callbacks.

Parameter NameParameter TypeDescription
Promise.then()Promise<void>Successful callback
Promise.catch()Promise<CatchResponse>Failure callback

Code Example

import IMSDK from 'openim-uniapp-polyfill';

IMSDK.asyncApi('setAppBackgroundStatus', IMSDK.uuid(), true)
.then(() => {
// Successful call
})
.catch(({ errCode, errMsg }) => {
// Failed call
});