SDKsAndroid
Set global message reception
Use setSelfInfo() to set the account-wide message reception and notification policy.
Use UserInfoReq to set globalRecvMsgOpt.
UserInfoReq request = new UserInfoReq();
request.setGlobalRecvMsgOpt(2);
OpenIMClient.getInstance().userInfoManager.setSelfInfo(
new OnBase<String>() {
@Override
public void onSuccess(String data) {
// Global message reception updated successfully.
}
@Override
public void onError(int code, String error) {
// Handle the error.
}
},
request
);| Value | Meaning |
|---|---|
0 | Receive messages and allow notifications. |
1 | Do not receive messages. |
2 | Receive messages without notifications. |
If the product exposes only a global do-not-disturb switch, it can toggle between 0 and 2; 1 stops message reception and should be presented as a separate option. Per-conversation reception is managed by conversation APIs.
A successful callback means the setting request completed.
Was this page helpful?