Configure push notification preferences
By registering or unregistering the current user's registration token to the Sendbird server as below, you can turn push notifications on or off in the user's client app. The registration and unregistration methods in the code below should be called after a user has established a connection with the Sendbird server by calling the SendbirdChat.connect()
method.
Through PushTriggerOption
, the current user can choose which type of messages will trigger push notifications, or opt to turn it off completely. Additionally, they can enable the Do Not Disturb and snooze features through setDoNotDisturb()
and setSnoozePeriod()
methods.
The SendbirdChat.PushTriggerOption
method allows users to configure when to receive notification messages as well as what types of messages trigger notification messages on the application level. The following are the available options.
List of push trigger options
Option | Description |
---|---|
ALL | When disconnected from the Sendbird server, the current user receives notifications for all new messages including messages the user has been mentioned in. |
MENTION_ONLY | When disconnected from the Sendbird server, the current user only receives notifications for messages the user has been mentioned in. |
OFF | The current user doesn't receive any notifications. |
The GroupChannel.PushTriggerOption
method also allows users to configure the trigger for notification messages as well as turn notifications on or off for each group channel. The following are the available options.
Option | Description |
---|---|
DEFAULT | The current user’s push notification trigger settings are automatically applied to the channel. This is the default setting. |
ALL | When disconnected from the Sendbird server, the current user receives notifications for all new messages in the channel including messages the user has been mentioned in. |
MENTION_ONLY | When disconnected from the Sendbird server, the current user only receives notifications for messages in the channel the user has been mentioned in. |
OFF | The current user doesn't receive any notifications in the channel. |
Do not disturb
If you want to routinely turn off push notification on the current user's client app according to a specified schedule, use our Do Not Disturb
feature like the following.
Note: The
Do Not Disturb
feature can also be set for a user with our update push notification preferences API.
Snooze
To snooze notification messages for a specific period of time, use our snooze
feature as below.
Note: The
snooze
notifications can also be set for a user with the update push preferences API.