/ SDKs / .NET
SDKs
Chat SDKs .NET v4
Chat SDKs .NET
Chat SDKs
.NET
Version 4

Configure push notification preferences

Copy link

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.

SendbirdChat.RegisterPushToken(SbPushTokenType.Fcm, TOKEN, inUnique: true, (inStatus, inError) =>
{
    if (inError != null)
        return; // Handle error.
});

SendbirdChat.UnregisterPushToken(SbPushTokenType.Fcm, TOKEN, (inError) =>
{
    if (inError != null)
        return; // Handle error.
});

SendbirdChat.UnregisterAllPushToken((inError) =>
{
    if (inError != null)
        return; // Handle error.
});

If you want to routinely turn off push notification on the current user's client app according to a specified schedule, use our SetDoNotDisturb feature like the following.

Note: The SetDoNotDisturb feature can also be set for a user with our update push notification preferences API.

SendbirdChat.SetDoNotDisturb(inEnabled: true, inStartHour: 12, inStartMin: 12, inEndHour: 12, inEndMin: 40, inTimezone: "Asia/Seoul", inError =>
{
    if (inError != null)
        return; //Handle error.
});

To snooze notification messages for a specific period of time, use our SetSnoozePeriod feature as below.

Note: The snooze notifications can also be set for a user through an API request to update push preferences.

SendbirdChat.SetSnoozePeriod(inEnabled: true, START_TIMESTAMP, END_TIMESTAMP, inError =>
{
    if (inError != null)
        return; //Handle error.
});