Class NotificationsHelper


  • public final class NotificationsHelper
    extends java.lang.Object
    • Field Detail

      • TRACK_NOTIFICATION_DELIVERED

        public static final java.lang.String TRACK_NOTIFICATION_DELIVERED
        See Also:
        Constant Field Values
      • TRACK_NOTIFICATION_OPENED

        public static final java.lang.String TRACK_NOTIFICATION_OPENED
        See Also:
        Constant Field Values
      • MESSAGE_RESPONSE_ID

        public static final java.lang.String MESSAGE_RESPONSE_ID
        See Also:
        Constant Field Values
      • UNREAD_MESSAGES_COUNT_KEY

        public static final java.lang.String UNREAD_MESSAGES_COUNT_KEY
        See Also:
        Constant Field Values
    • Method Detail

      • initializeTrackingConfiguration

        public static void initializeTrackingConfiguration()
        Populate Tracking API details based on current saved credentials
      • trackNotification

        public static void trackNotification​(TrackingParams trackingParams,
                                             int id,
                                             android.content.Context context,
                                             java.lang.String messageState)
        Notify the server that a notification message is opened
        Parameters:
        trackingParams - TrackingParams to use for TrackingAPI
        id - id of the object
        context - context for accessing shared preference
        messageState - value of action parameter
      • trackNotification

        public static void trackNotification​(int id,
                                             android.content.Context context,
                                             java.lang.String messageState)
        Notify the server that a notification message is opened
        Parameters:
        id - id of the object
        context - context for accessing shared preference
        messageState - value of action parameter
      • clearNotificationID

        public static void clearNotificationID​(int id,
                                               android.content.Context context)
        Clear the notification id stored in preference
        Parameters:
        id - notification id
        context - used to get resources
      • removeAllNotification

        public static void removeAllNotification​(android.content.Context context)
        Remove all saved push notifications
        Parameters:
        context - used to get resources
      • saveMapToSharedPrefs

        public static void saveMapToSharedPrefs​(android.content.Context context,
                                                java.util.HashMap<java.lang.Integer,​java.lang.Integer> hashMap)
        Store notification ids in preference as map
        Parameters:
        context - used to get resources
        hashMap - map to store
      • removeNotification

        public static void removeNotification​(int id,
                                              android.content.Context context)
        Clear the notifications in status bar
        Parameters:
        id - reference of the notification
        context - used to get resources
      • saveNotification

        public static void saveNotification​(int messageID,
                                            int timeStamp,
                                            android.content.Context context)
        Save the notification id in preference
        Parameters:
        messageID - notification id
        timeStamp - time stamp used as value
        context - used to get resources
      • createIntentFromAttachment

        public static android.content.Intent createIntentFromAttachment​(android.content.Context context,
                                                                        java.lang.String type,
                                                                        int id,
                                                                        int messageResponseId)
        Creates an intent from attachment
        Parameters:
        context - used to get resources
        type - attachment type (challenge, offer, offer response, reward, post, person, event)
        id - id of the attachment
        messageResponseId - message response id
        Returns:
        Intent created based on the attachment type