public final class Notifications
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static void |
arePushNotificationsEnabled(Callback<java.lang.Boolean> callback,
FailureCallback failure)
Check if PNs are enabled for current user.
|
static void |
get(PagingQuery<NotificationsQuery> query,
Callback<PagingResult<Notification>> callback,
FailureCallback failure)
Get the list of notifications for current user.
|
static void |
getCount(NotificationsQuery query,
Callback<java.lang.Integer> callback,
FailureCallback failure)
Get a number of notifications for current user.
|
static void |
registerDevice()
If autoRegisterForPush meta property is set to false in the getsocial.json,
call this method to register for push notifications.
|
static void |
send(NotificationContent notificationContent,
SendNotificationTarget target,
CompletionCallback callback,
FailureCallback failure)
Send notification to any GetSocial user.
|
static void |
setOnNotificationClickedListener(OnNotificationClickedListener listener)
Set a notification listener, you can handle a click on notification in
OnNotificationClickedListener.onNotificationClicked(Notification, NotificationContext) method. |
static void |
setOnNotificationReceivedListener(OnNotificationReceivedListener listener)
Set a notification listener, you can handle notification while application is in foreground.
|
static void |
setOnTokenReceivedListener(OnTokenReceivedListener listener)
Set a listener to be called when Push Notifications token obtained by GetSocial.
|
static void |
setPushNotificationsEnabled(boolean isEnabled,
CompletionCallback completionCallback,
FailureCallback failure)
If set to `false` - current user won't receive GetSocial notifications anymore, until called with `true`.
|
static void |
setStatus(java.lang.String status,
java.util.List<java.lang.String> notificationIds,
CompletionCallback callback,
FailureCallback failure)
Set notifications status to one of
NotificationStatus . |
public static void registerDevice()
public static void setOnNotificationClickedListener(OnNotificationClickedListener listener)
OnNotificationClickedListener.onNotificationClicked(Notification, NotificationContext)
method.listener
- An object that will be notified with clicked notification.public static void setOnNotificationReceivedListener(OnNotificationReceivedListener listener)
listener
- An object that will be notified with received notification.public static void setOnTokenReceivedListener(OnTokenReceivedListener listener)
listener
- An object that will be notified with push token.public static void get(PagingQuery<NotificationsQuery> query, Callback<PagingResult<Notification>> callback, FailureCallback failure)
query
- Notifications query.callback
- Callback to be invoked with a list of notifications.failure
- Called if operation failed.public static void getCount(NotificationsQuery query, Callback<java.lang.Integer> callback, FailureCallback failure)
query
- Notifications count query.callback
- Callback to be invoked with a number of notifications.failure
- Called if operation failed.public static void setStatus(java.lang.String status, java.util.List<java.lang.String> notificationIds, CompletionCallback callback, FailureCallback failure)
NotificationStatus
.status
- One of NotificationStatus
.notificationIds
- List of notifications IDs to change the read status.callback
- A callback to indicate if this operation was successful.failure
- Called if operation failed.public static void send(NotificationContent notificationContent, SendNotificationTarget target, CompletionCallback callback, FailureCallback failure)
SendNotificationPlaceholders.Receivers
.notificationContent
- Content of push notification.target
- List of user IDs or placeholders who will receive the notification.callback
- Notifies if operation was successful.failure
- Called if operation failed.public static void setPushNotificationsEnabled(boolean isEnabled, CompletionCallback completionCallback, FailureCallback failure)
isEnabled
- Disabled or enable PNs.completionCallback
- A callback to indicate if this operation was successful.failure
- Called if operation failed.public static void arePushNotificationsEnabled(Callback<java.lang.Boolean> callback, FailureCallback failure)
callback
- Called with `true` if is enabled, with `false` otherwise.failure
- Called if operation failed.(c) Copyright GetSocial BV, 2021. All Rights Reserved.