Mute Push Notifications

Magnet Message provides an easy way for developers to mute and unmute push notifications on a user's subscribed channels. When a channel is muted, an offline user will not receive push notifications as they normally would. This can be really useful when designing an app with a great user experience in mind. For example, perhaps a user may not want to receive notifications while they are at work, or while they are sleeping. With Magnet Message you can add time-based mute and unmute functionality to your app on a per channel basis.

Mute Channel

To mute a channel simply call the mute method with a time period parameter on the target channel.

channel.mute(new MMXChannel.OnFinishedListener<Void>() { @Override public void onSuccess(Void result) { } @Override public void onFailure(MMXChannel.FailureCode code, Throwable ex) { } });

Set Mute Duration

Additionally a date or time period can be specified to mute a channel for a specific duration, if no date is specified the channel will be muted in perpetuity.

Date untilDate = ... channel.mute(untilDate, new MMXChannel.OnFinishedListener<Void>() { @Override public void onSuccess(Void result) { } @Override public void onFailure(MMXChannel.FailureCode code, Throwable ex) { } });

Unmute Channel

Similarly, to unmute a channel simply call unmute on the target channel.

channel.unmute(new MMXChannel.OnFinishedListener<Void>() { @Override public void onSuccess(Void result) { } @Override public void onFailure(MMXChannel.FailureCode code, Throwable ex) { } });

View Mute Status

Each instance of MMXChannel contains attributes to identify a channel's "mute" status.

if (channel.isMuted()) { //this channel is muted } else { //this channel is not muted }


Next Steps

See how to create a Private Discussion Group in your app.