Class NotificationBundle
-
- All Implemented Interfaces:
public final class NotificationBundle
Wrapper with helpers to load data from the bundle received with a notification sent using Marigold Platform
-
-
Field Summary
Fields Modifier and Type Field Description public final static String
EXTRA_NOTIFICATION_ID
public final static String
BUNDLE_KEY_PAYLOAD
public final static String
BUNDLE_KEY_PAYLOAD_IMAGE
public final static String
BUNDLE_KEY_PAYLOAD_VIDEO
public final static String
BUNDLE_KEY_PAYLOAD_MID
public final static String
BUNDLE_KEY_COLLAPSE_KEY
public final static String
BUNDLE_KEY_DEEP_LINK
public final static String
BUNDLE_KEY_ALERT
public final static String
BUNDLE_KEY_BADGE
public final static String
BUNDLE_KEY_SOUND
public final static String
BUNDLE_KEY_CATEGORY
public final static String
BUNDLE_KEY_TITLE
public final static String
BUNDLE_KEY_CHANNEL_ID
public final static String
BUNDLE_KEY_ACTIONS
private final Bundle
bundle
-
Constructor Summary
Constructors Constructor Description NotificationBundle(RemoteMessage remoteMessage)
Construct a new instance of NotificationBundle
, from the provided RemoteMessageNotificationBundle(Bundle bundle)
-
Method Summary
Modifier and Type Method Description final Bundle
getBundle()
final Integer
generateAndroidNotificationID()
Build an id to be used to identify the notification while calling android.app.NotificationManager.notify. final Integer
generateAndroidNotificationActionID(String actionName)
Generates unique IDs for Notification Actions to so that unique PendingIntents can be created for them. final Boolean
isDeepLinkNotification()
final String
getDeepLink()
final String
getTitle()
final String
getSound(String defaultValue)
final String
getChannelId()
final String
getAlert()
final String
getMessageIdFromPayload()
final String
getImageUrlFromPayload()
final String
getVideoUrlFromPayload()
final String
getCategory()
final String
getNotificationId()
final String
getBadge()
final JSONObject
getActions()
final String
getActionLink(ActionTapped actionTapped)
Retrieves any custom links/deeplinks for this action from the notification payload and returns as a string. final Bundle
getRemoteInputBundle()
Return bundle containing remote input results. final Unit
setRemoteInputBundle(Bundle remoteInputBundle)
Set the bundle containing the remote input results. Boolean
equals(Object other)
Integer
hashCode()
-
-
Constructor Detail
-
NotificationBundle
NotificationBundle(RemoteMessage remoteMessage)
Construct a new instance ofNotificationBundle
, from the provided RemoteMessage- Parameters:
remoteMessage
- an FCM RemoteMessage
-
NotificationBundle
NotificationBundle(Bundle bundle)
-
-
Method Detail
-
generateAndroidNotificationID
final Integer generateAndroidNotificationID()
Build an id to be used to identify the notification while calling android.app.NotificationManager.notify. This ID is used by the Android OS to collapse notifications, if necessary.
- Returns:
hashcode of: the
collapse_key
when available, otherwise the Marigold notification ID (guaranteed to be unique), and if that's not available generates a random id
-
generateAndroidNotificationActionID
final Integer generateAndroidNotificationActionID(String actionName)
Generates unique IDs for Notification Actions to so that unique PendingIntents can be created for them.
- Parameters:
actionName
- the name of the action- Returns:
hashcode of the Marigold notification ID and the action name.
-
isDeepLinkNotification
final Boolean isDeepLinkNotification()
-
getDeepLink
final String getDeepLink()
-
getChannelId
final String getChannelId()
-
getMessageIdFromPayload
final String getMessageIdFromPayload()
-
getImageUrlFromPayload
final String getImageUrlFromPayload()
-
getVideoUrlFromPayload
final String getVideoUrlFromPayload()
-
getCategory
final String getCategory()
-
getNotificationId
final String getNotificationId()
-
getActions
final JSONObject getActions()
-
getActionLink
final String getActionLink(ActionTapped actionTapped)
Retrieves any custom links/deeplinks for this action from the notification payload and returns as a string.
- Returns:
String containing the link/deeplink for the action to route to.
-
getRemoteInputBundle
final Bundle getRemoteInputBundle()
Return bundle containing remote input results.
- Returns:
Remote input bundle
-
setRemoteInputBundle
final Unit setRemoteInputBundle(Bundle remoteInputBundle)
Set the bundle containing the remote input results.
- Parameters:
remoteInputBundle
- Bundle containing remote input results.
-
-
-
-