Interface AppNotificationHandler
-
public interface AppNotificationHandlerHandler to send app notifications (aka push notifications).
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleancanReceiveNotifications(BasicUser user)Returns true if app notifications were configured for the user (i.eisEnabled(ConfigurationAccessor)is true) and the user has the required mediums to receive it (e.g in case of FCM, has a registration token assigned).
Returning false means no app notifications will be sent to this specific user.booleanisEnabled(ConfigurationAccessor configuration)Returns whether the app notifications are configured for the given configuration.booleannotify(AppNotificationMessage notification)Sends (synchronously) a new app notification.<T> Tunwrap(Class<T> clazz, BasicUser user)Returns an object of the specified type to allow access to the underlying implementation.
If the current implementation does not support the specified class or the given user can not receive notifications, null is returned.voidvalidate(BasicUser user, Object medium)Validates the given medium used to send the app notification to the user.
The medium depends on the underlying implementation (e.g in case of FCM it would be a token of type String).
-
-
-
Method Detail
-
canReceiveNotifications
boolean canReceiveNotifications(BasicUser user)
Returns true if app notifications were configured for the user (i.eisEnabled(ConfigurationAccessor)is true) and the user has the required mediums to receive it (e.g in case of FCM, has a registration token assigned).
Returning false means no app notifications will be sent to this specific user.
-
isEnabled
boolean isEnabled(ConfigurationAccessor configuration)
Returns whether the app notifications are configured for the given configuration.
-
notify
boolean notify(AppNotificationMessage notification) throws AppNotificationException
Sends (synchronously) a new app notification.- Returns:
- whether the notification was sent or not.
- Throws:
AppNotificationException
-
unwrap
<T> T unwrap(Class<T> clazz, BasicUser user) throws AppNotificationException
Returns an object of the specified type to allow access to the underlying implementation.
If the current implementation does not support the specified class or the given user can not receive notifications, null is returned.- Throws:
AppNotificationException
-
validate
void validate(BasicUser user, Object medium) throws AppNotificationException, ValidationException
Validates the given medium used to send the app notification to the user.
The medium depends on the underlying implementation (e.g in case of FCM it would be a token of type String).
-
-