Set global message reception
Configure default message reception and notification behavior for the current account using the OpenIM Flutter SDK.
Configure default global message reception and offline push notification policies across all single-chat and group-chat conversations for the current account:
Parameters
Specify the globalRecvMsgOpt parameter in setSelfInfo to configure account-level do-not-disturb (DND) behavior without altering other profile fields:
| Parameter | Type | Required | Description |
|---|---|---|---|
globalRecvMsgOpt | int | Yes | Global message reception option enumeration value. Typically toggles between normal delivery and do-not-disturb. |
| Enum Option | Value | Behavior |
|---|---|---|
ReceiveMessageOpt.receive | 0 | Receive messages normally with offline push notifications enabled. |
ReceiveMessageOpt.notNotify | 2 | Receive messages silently without triggering offline push or system notification banners (DND mode). |
Code example
await OpenIM.iMManager.userManager.setSelfInfo(
globalRecvMsgOpt: ReceiveMessageOpt.notNotify,
);Return value
A successful Future returns void, indicating that the global message reception configuration was committed to the server.
State changes after the call
This method alters user state. Per-conversation reception options take precedence over this global account default. To configure individual conversation rules, see Set conversation message receive option.
When the update takes effect on the server, all active client sessions for this account receive onSelfInfoUpdated event notifications. Use userID as the merge key to update the current user's cached profile. For profile update listener implementation, see Update self profile.
Was this page helpful?