Set the global message receive option
Set the current account’s default message reception and notification behavior with the OpenIM Flutter SDK.
Write globalRecvMsgOpt separately through setSelfInfo(). Do not overwrite this account-level message policy as a side effect of saving a nickname or avatar.
await OpenIM.iMManager.userManager.setSelfInfo(
globalRecvMsgOpt: ReceiveMessageOpt.notNotify,
);| Constant | Value | Meaning |
|---|---|---|
ReceiveMessageOpt.receive | 0 | Receive messages normally and allow offline pushes or notifications. |
ReceiveMessageOpt.notReceive | 1 | Do not receive messages or trigger offline pushes or notifications. |
ReceiveMessageOpt.notNotify | 2 | Receive messages without triggering offline pushes or notifications. |
If the product exposes only a global Do Not Disturb switch, it should generally toggle between receive and notNotify. Because notReceive stops message reception, present it as a separate option with different semantics.
An individual conversation can have its own receive option; see Set the conversation message receive option. A successful Future means only that the request completed. Reconcile the final account snapshot through onSelfInfoUpdated or another query; the event belongs to Update the current user’s profile.
Was this page helpful?