Class NotificationsHelper
- java.lang.Object
-
- com.cheetahdigital.corekit.helpers.NotificationsHelper
-
public final class NotificationsHelper extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classNotificationsHelper.ATTACHMENT_TYPESDescribes the different Message Types that can be received from the API
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringMESSAGE_RESPONSE_IDstatic java.lang.StringTRACK_NOTIFICATION_DELIVEREDstatic java.lang.StringTRACK_NOTIFICATION_OPENEDstatic java.lang.StringUNREAD_MESSAGES_COUNT_KEY
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidclearNotificationID(int id, android.content.Context context)Clear the notification id stored in preferencestatic android.content.IntentcreateIntentFromAttachment(android.content.Context context, java.lang.String type, int id, int messageResponseId)Creates an intent from attachmentstatic NotificationsHelper.ATTACHMENT_TYPESgetAttachmentType(java.lang.String type)static voidinitializeTrackingConfiguration()Populate Tracking API details based on current saved credentialsstatic voidremoveAllNotification(android.content.Context context)Remove all saved push notificationsstatic voidremoveNotification(int id, android.content.Context context)Clear the notifications in status barstatic voidsaveMapToSharedPrefs(android.content.Context context, java.util.HashMap<java.lang.Integer,java.lang.Integer> hashMap)Store notification ids in preference as mapstatic voidsaveNotification(int messageID, int timeStamp, android.content.Context context)Save the notification id in preferencestatic voidtrackNotification(int id, android.content.Context context, java.lang.String messageState)Notify the server that a notification message is openedstatic voidtrackNotification(TrackingParams trackingParams, int id, android.content.Context context, java.lang.String messageState)Notify the server that a notification message is opened
-
-
-
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-TrackingParamsto use forTrackingAPIid- id of the objectcontext- context for accessing shared preferencemessageState- 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 objectcontext- context for accessing shared preferencemessageState- 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 idcontext- 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 resourceshashMap- 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 notificationcontext- 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 idtimeStamp- time stamp used as valuecontext- 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 resourcestype- attachment type (challenge, offer, offer response, reward, post, person, event)id- id of the attachmentmessageResponseId- message response id- Returns:
Intentcreated based on the attachment type
-
getAttachmentType
public static NotificationsHelper.ATTACHMENT_TYPES getAttachmentType(java.lang.String type)
- Parameters:
type- value where attachment type is extracted- Returns:
- an
NotificationsHelper.ATTACHMENT_TYPES
-
-