-
public class SendBird.HMS
Push token related class specifically for Huawei Message Service, HMS.
-
-
Method Summary
Modifier and Type Method Description static String
getPendingPushToken()
Gets the pending HMS push token. static void
registerPushTokenForCurrentUser(String token, SendBird.RegisterPushTokenWithStatusHandler handler)
Registers push token for the current User
to receive push notification.static void
registerPushTokenForCurrentUser(String token, boolean unique, SendBird.RegisterPushTokenWithStatusHandler handler)
Registers push token for the current User
to receive push notification.static void
unregisterPushTokenForCurrentUser(String token, SendBird.UnregisterPushTokenHandler handler)
Unregisters push token for the current User
.static void
unregisterPushTokenAllForCurrentUser(SendBird.UnregisterPushTokenHandler handler)
Unregisters all push token bound to the current User
.static void
getMyPushTokensByToken(String token, SendBird.PushTokenType type, SendBird.GetPushTokensHandler handler)
Requests push tokens of current user from given token. static void
setDoNotDisturb(boolean doNotDisturbOn, int startHour, int startMin, int endHour, int endMin, String timezone, SendBird.SetDoNotDisturbHandler handler)
Sets Do-not-disturb option for the current User
.static void
getDoNotDisturb(SendBird.GetDoNotDisturbHandler handler)
Gets Do-not-disturb option for the current User
.static void
setSnoozePeriod(boolean snoozeOn, long startTs, long endTs, SendBird.SetSnoozePeriodHandler handler)
Sets snooze period for the current User
.static void
getSnoozePeriod(SendBird.GetSnoozePeriodHandler handler)
Gets snooze period for the current User
.static void
setPushSound(String sound, SendBird.SetPushSoundHandler handler)
Sets the push notification sound file path for the current User
.This setting will be delivered on push notification payload.static void
getPushSound(SendBird.GetPushSoundHandler handler)
Gets push notification sound path for the current User
.static void
setPushTemplate(String templateName, SendBird.SetPushTemplateHandler handler)
Sets push template option for the current User
.static void
getPushTemplate(SendBird.GetPushTemplateHandler handler)
Gets push template option for the current User
.static void
setPushTriggerOption(SendBird.PushTriggerOption pushTriggerOption, SendBird.SetPushTriggerOptionHandler handler)
Sets the current User
's push trigger option.static void
getPushTriggerOption(SendBird.GetPushTriggerOptionHandler handler)
Gets the current User
's push trigger option.-
-
Method Detail
-
getPendingPushToken
static String getPendingPushToken()
Gets the pending HMS push token.
-
registerPushTokenForCurrentUser
static void registerPushTokenForCurrentUser(String token, SendBird.RegisterPushTokenWithStatusHandler handler)
Registers push token for the current
User
to receive push notification.To enable push notification and get a token, refer to SendBird Docs.Push token registration succeeds only when the connection (connect, connect) is made.Otherwise, callback will return with PENDING status. Then you can register push token again by calling this method with getPendingPushToken as the token parameter, after the connection is done.This just adds token to the server. If you want to register this token and delete all the previous ones, refer to registerPushTokenForCurrentUser.- Parameters:
token
- HMS push token.handler
- Callback handler.
-
registerPushTokenForCurrentUser
static void registerPushTokenForCurrentUser(String token, boolean unique, SendBird.RegisterPushTokenWithStatusHandler handler)
Registers push token for the current
User
to receive push notification.To enable push notification and get a token, refer to SendBird Docs.Push token registration succeeds only when the connection (connect, connect) is made.Otherwise, callback will return with PENDING status. Then you can register push token again by calling this method with getPendingPushToken as the token parameter, after the connection is done.- Parameters:
token
- HMS push token.unique
- If true, all the previously registered token for the currentUser
will be deleted and this token will be the unique one.handler
- Callback handler.
-
unregisterPushTokenForCurrentUser
static void unregisterPushTokenForCurrentUser(String token, SendBird.UnregisterPushTokenHandler handler)
Unregisters push token for the current
User
.- Parameters:
token
- HMS push token.handler
- Callback handler.
-
unregisterPushTokenAllForCurrentUser
static void unregisterPushTokenAllForCurrentUser(SendBird.UnregisterPushTokenHandler handler)
Unregisters all push token bound to the current
User
.- Parameters:
handler
- Callback handler.
-
getMyPushTokensByToken
static void getMyPushTokensByToken(String token, SendBird.PushTokenType type, SendBird.GetPushTokensHandler handler)
Requests push tokens of current user from given token.The result is passed to
handler
.- Parameters:
token
- Token to get next push tokens.type
- PushTokenType.handler
- Callback handler.
-
setDoNotDisturb
static void setDoNotDisturb(boolean doNotDisturbOn, int startHour, int startMin, int endHour, int endMin, String timezone, SendBird.SetDoNotDisturbHandler handler)
Sets Do-not-disturb option for the current
User
.If this option is enabled, the currentUser
does not receive push notification during the specified time repeatedly.If you want to snooze specific period, use setSnoozePeriod.- Parameters:
doNotDisturbOn
- Enables option or not.startHour
- Start hour (0~23).startMin
- Start minute (0~59).endHour
- End hour (0~23).endMin
- End minute (0~59).timezone
- Timezone.handler
- Callback handler.
-
getDoNotDisturb
static void getDoNotDisturb(SendBird.GetDoNotDisturbHandler handler)
Gets Do-not-disturb option for the current
User
.- Parameters:
handler
- Callback handler.
-
setSnoozePeriod
static void setSnoozePeriod(boolean snoozeOn, long startTs, long endTs, SendBird.SetSnoozePeriodHandler handler)
Sets snooze period for the current
User
.If this option is enabled, the currentUser
does not receive push notification during the given period. It's not a repetitive operation.If you want to snooze repeatedly, use setDoNotDisturb.- Parameters:
snoozeOn
- Enables option or not.startTs
- Start timestamp of snooze periodendTs
- End timestamp of snooze periodhandler
- Callback handler.
-
getSnoozePeriod
static void getSnoozePeriod(SendBird.GetSnoozePeriodHandler handler)
Gets snooze period for the current
User
.- Parameters:
handler
- Callback handler.
-
setPushSound
static void setPushSound(String sound, SendBird.SetPushSoundHandler handler)
Sets the push notification sound file path for the current
User
.This setting will be delivered on push notification payload.- Parameters:
sound
- Sound file path.handler
- Callback handler.
-
getPushSound
static void getPushSound(SendBird.GetPushSoundHandler handler)
Gets push notification sound path for the current
User
.- Parameters:
handler
- Callback handler.
-
setPushTemplate
static void setPushTemplate(String templateName, SendBird.SetPushTemplateHandler handler)
Sets push template option for the current
User
. The only valid arguments for template name are PUSH_TEMPLATE_DEFAULT and PUSH_TEMPLATE_ALTERNATIVE.If PUSH_TEMPLATE_DEFAULT is set, the push notification will contain the original message in themessage
field of the push notification.If PUSH_TEMPLATE_ALTERNATIVE is set,message
of push notification will be replaced by the content you've set onSendBird Dashboard.- Parameters:
templateName
- Name of template to be applied to currentUser
.handler
- Callback handler.
-
getPushTemplate
static void getPushTemplate(SendBird.GetPushTemplateHandler handler)
Gets push template option for the current
User
. For details of push template option, refer to setPushTemplate.This can be used, for instance, when you need to check the push notification content preview is on or off at the moment.- Parameters:
handler
- Callback handler.
-
setPushTriggerOption
static void setPushTriggerOption(SendBird.PushTriggerOption pushTriggerOption, SendBird.SetPushTriggerOptionHandler handler)
Sets the current
User
's push trigger option.If certain channel's push trigger option is set to DEFAULT, it works according to the state of SendBird.PushTriggerOption.If not, push messages will be triggered according to the state of GroupChannel.PushTriggerOption.Refer to GroupChannel.PushTriggerOption.- Parameters:
pushTriggerOption
-PushTriggerOption
.handler
- Callback handler.
-
getPushTriggerOption
static void getPushTriggerOption(SendBird.GetPushTriggerOptionHandler handler)
Gets the current
User
's push trigger option. Refer to SendBird.PushTriggerOption.For details of push trigger option, refer to setPushTriggerOption.- Parameters:
handler
- Callback handler.
-
-
-
-