doBackground
Introduction
Invoking this method when the APP changes to the background state.
The offline notification push of new messages will be triggered immediately, after you config the related settings.
This method is supposed to be called manually on Android devices only, while the SDK can take in charger of it on iOS.
Parameter details
Parameter name | Parameter type | Required | Description |
---|---|---|---|
unreadCount | number | yes | unread count of message in app |
Returned template
V2TimCallback
{
code : number
desc : string
}
Return value details
name | type | description |
---|---|---|
code | number | Request result: Error codes. 0 means success. |
desc | string | The description of the error. It will be empty if success. |
Code example
import { TencentImSDKPlugin } from 'react-native-tim-js';
const doBackgroundRes = await TencentImSDKPlugin.v2TIMManager
.getOfflinePushManager()
.doBackground(0);
if (doBackgroundRes.code === 0) {
}