-
- All Implemented Interfaces:
-
com.batch.android.PushUserActionSource,com.batch.android.UserActionSource
public class BatchPushPayload implements PushUserActionSource
Convenience object to retrieve standardized Batch data out of a Batch Push intent.This class does not have a public constructor. You must use payloadFromBundle or payloadFromReceiverIntent
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classBatchPushPayload.ParsingExceptionRepresents a payload parsing exception.This usually means that the given bundle or receiver intent doesn't contain data that BatchPushPayload understands.
-
Method Summary
Modifier and Type Method Description static BatchPushPayloadpayloadFromBundle(@Nullable() Bundle bundle)Attempt to extract the Batch Push data contained within the specified Bundle. static BatchPushPayloadpayloadFromReceiverIntent(@NonNull() Intent intent)Attempt to extract the Batch Push data contained within the specified Intent. static BatchPushPayloadpayloadFromReceiverExtras(@NonNull() Bundle extras)Attempt to extract the Batch Push data contained within the specified Intent extras. static BatchPushPayloadpayloadFromFirebaseMessage(@NonNull() RemoteMessage remoteMessage)Attempt to extract the Batch Push data contained within the specified Firebase RemoteMessage. voidwriteToBundle(@NonNull() Bundle bundle)Serialize this instance into a Bundle. voidwriteToIntentExtras(@NonNull() Intent intent)Serialize this instance into an Intent. booleanhasDeeplink()Does this push contains a deeplink StringgetDeeplink()Get the deeplink url contained in this push. booleanhasCustomLargeIcon()Does this push contains a custom large icon StringgetCustomLargeIconURL(Context context)Get the custom large icon url contained in this push. booleanhasBigPicture()Does this push contains a big picture StringgetBigPictureURL(Context context)Get the big picture url contained in this push. booleanhasLandingMessage()Whether the payload contains a landing message or not BatchMessagegetLandingMessage()Returns the landing message that's in this payload if there is one. List<BatchNotificationAction>getActions()Get the actions associated with this push, if any. intgetPriority()Get the notification priorityThis integer value is the same one as priorities defined in androidx.core.app.NotificationCompat StringgetGroup()Get the notification group name. booleanisGroupSummary()Get the notification group name. StringgetChannel()Get the desired notification channel. BundlegetPushBundle()Get the raw push bundle -
-
Method Detail
-
payloadFromBundle
static BatchPushPayload payloadFromBundle(@Nullable() Bundle bundle)
Attempt to extract the Batch Push data contained within the specified Bundle.This is usually the method you want to use when reading this payload from an activity opened by Batch,or when you wrote an existing BatchPushPayload to a Bundle/Intent extras using writeToBundle / writeToIntentExtras.
- Parameters:
bundle- Bundle containing Batch Push data.
-
payloadFromReceiverIntent
static BatchPushPayload payloadFromReceiverIntent(@NonNull() Intent intent)
Attempt to extract the Batch Push data contained within the specified Intent.This is usually the method you want to use when reading this payload from a push broadcast receiver/service, NOT from an activity intent.If you wrote an existing BatchPushPayload to a Bundle/Intent extras using writeToBundle / writeToIntentExtras, you should rather use payloadFromBundle
- Parameters:
intent- Broadcast receiver intent containing Batch Push data.
-
payloadFromReceiverExtras
static BatchPushPayload payloadFromReceiverExtras(@NonNull() Bundle extras)
Attempt to extract the Batch Push data contained within the specified Intent extras.This is usually the method you want to use when reading this payload from a push broadcast receiver/service, NOT from an activity intent.If you wrote an existing BatchPushPayload to a Bundle/Intent extras using writeToBundle / writeToIntentExtras, you should rather use payloadFromBundle
- Parameters:
extras- Broadcast receiver intent's extras containing Batch Push data.
-
payloadFromFirebaseMessage
static BatchPushPayload payloadFromFirebaseMessage(@NonNull() RemoteMessage remoteMessage)
Attempt to extract the Batch Push data contained within the specified Firebase RemoteMessage.This is usually the method you want to use when reading this payload from a FirebaseMessagingService implementation, NOT from an activity intent.If you wrote an existing BatchPushPayload to a Bundle/Intent extras using writeToBundle / writeToIntentExtras, you should rather use payloadFromBundle
- Parameters:
remoteMessage- Firebase remote message containing Batch Push data.
-
writeToBundle
void writeToBundle(@NonNull() Bundle bundle)
Serialize this instance into a Bundle.Note that you'll need to use payloadFromBundle with the intent's extras to read it back.
- Parameters:
bundle- Bundle instance to serialize this in
-
writeToIntentExtras
void writeToIntentExtras(@NonNull() Intent intent)
Serialize this instance into an Intent. Note that you'll need to use payloadFromBundle with the intent's extras to read it back.This method WILL NOT fill the intent in a format that payloadFromReceiverIntent understands.
- Parameters:
intent- Intent instance to serialize this in
-
hasDeeplink
boolean hasDeeplink()
Does this push contains a deeplink
-
getDeeplink
String getDeeplink()
Get the deeplink url contained in this push.You should always check if the push contains a deeplink using hasDeeplink
-
hasCustomLargeIcon
boolean hasCustomLargeIcon()
Does this push contains a custom large icon
-
getCustomLargeIconURL
String getCustomLargeIconURL(Context context)
Get the custom large icon url contained in this push.You should always check if the push contains a custom large icon using hasCustomLargeIcon.The url returned by this method is already optimized for the device, you have to download the image and use it in the notification
-
hasBigPicture
boolean hasBigPicture()
Does this push contains a big picture
-
getBigPictureURL
String getBigPictureURL(Context context)
Get the big picture url contained in this push.You should always check if the push contains a big picture using hasBigPicture.The url returned by this method is already optimized for the device, you have to download the image and use it in the notification
-
hasLandingMessage
boolean hasLandingMessage()
Whether the payload contains a landing message or not
-
getLandingMessage
BatchMessage getLandingMessage()
Returns the landing message that's in this payload if there is one.
-
getActions
List<BatchNotificationAction> getActions()
Get the actions associated with this push, if any.
-
getPriority
@Deprecated() int getPriority()
Get the notification priority
This integer value is the same one as priorities defined in androidx.core.app.NotificationCompat
-
isGroupSummary
boolean isGroupSummary()
Get the notification group name. Meant to be used with setGroupSummary
-
getChannel
@Nullable() String getChannel()
Get the desired notification channel. Meant to be used with setChannelId
-
getPushBundle
Bundle getPushBundle()
Get the raw push bundle
-
-
-
-