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 class
NotificationsHelper.ATTACHMENT_TYPES
Describes the different Message Types that can be received from the API
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
MESSAGE_RESPONSE_ID
static java.lang.String
TRACK_NOTIFICATION_DELIVERED
static java.lang.String
TRACK_NOTIFICATION_OPENED
static java.lang.String
UNREAD_MESSAGES_COUNT_KEY
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
clearNotificationID(int id, android.content.Context context)
Clear the notification id stored in preferencestatic android.content.Intent
createIntentFromAttachment(android.content.Context context, java.lang.String type, int id, int messageResponseId)
Creates an intent from attachmentstatic NotificationsHelper.ATTACHMENT_TYPES
getAttachmentType(java.lang.String type)
static void
initializeTrackingConfiguration()
Populate Tracking API details based on current saved credentialsstatic void
removeAllNotification(android.content.Context context)
Remove all saved push notificationsstatic void
removeNotification(int id, android.content.Context context)
Clear the notifications in status barstatic void
saveMapToSharedPrefs(android.content.Context context, java.util.HashMap<java.lang.Integer,java.lang.Integer> hashMap)
Store notification ids in preference as mapstatic void
saveNotification(int messageID, int timeStamp, android.content.Context context)
Save the notification id in preferencestatic void
trackNotification(int id, android.content.Context context, java.lang.String messageState)
Notify the server that a notification message is openedstatic void
trackNotification(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
-TrackingParams
to use forTrackingAPI
id
- 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:
Intent
created 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
-
-