Class Notifications


  • public final class Notifications
    extends java.lang.Object
    • Method Detail

      • registerDevice

        public static void registerDevice()
        If autoRegisterForPush meta property is set to false in the getsocial.json, call this method to register for push notifications.
      • setOnNotificationReceivedListener

        public static void setOnNotificationReceivedListener​(OnNotificationReceivedListener listener)
        Set a notification listener, you can handle notification while application is in foreground.
        Parameters:
        listener - An object that will be notified with received notification.
      • setOnTokenReceivedListener

        public static void setOnTokenReceivedListener​(OnTokenReceivedListener listener)
        Set a listener to be called when Push Notifications token obtained by GetSocial.
        Parameters:
        listener - An object that will be notified with push token.
      • getCount

        public static void getCount​(NotificationsQuery query,
                                    Callback<java.lang.Integer> callback,
                                    FailureCallback failure)
        Get a number of notifications for current user.
        Parameters:
        query - Notifications count query.
        callback - Callback to be invoked with a number of notifications.
        failure - Called if operation failed.
      • setStatus

        public 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.
        Parameters:
        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.
      • setPushNotificationsEnabled

        public 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`.
        Parameters:
        isEnabled - Disabled or enable PNs.
        completionCallback - A callback to indicate if this operation was successful.
        failure - Called if operation failed.
      • arePushNotificationsEnabled

        public static void arePushNotificationsEnabled​(Callback<java.lang.Boolean> callback,
                                                       FailureCallback failure)
        Check if PNs are enabled for current user.
        Parameters:
        callback - Called with `true` if is enabled, with `false` otherwise.
        failure - Called if operation failed.