Class BatchPushPayload

    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      java.util.List<BatchNotificationAction> getActions()
      Get the actions associated with this push, if any.
      java.lang.String getBigPictureURL​(android.content.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
      java.lang.String getChannel()
      Get the desired notification channel.
      java.lang.String getCustomLargeIconURL​(android.content.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
      java.lang.String getDeeplink()
      Get the deeplink url contained in this push.
      You should always check if the push contains a deeplink using hasDeeplink()
      java.lang.String getGroup()
      Get the notification group name.
      BatchMessage getLandingMessage()
      Returns the landing message that's in this payload if there is one.
      int getPriority()
      Deprecated.
      Since Android 8.0, "priority" became "importance", and is now set on the channel itself.
      android.os.Bundle getPushBundle()
      Get the raw push bundle
      boolean hasBigPicture()
      Does this push contains a big picture
      boolean hasCustomLargeIcon()
      Does this push contains a custom large icon
      boolean hasDeeplink()
      Does this push contains a deeplink
      boolean hasLandingMessage()
      Whether the payload contains a landing message or not
      boolean isGroupSummary()
      Get the notification group name.
      static BatchPushPayload payloadFromBundle​(android.os.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(Bundle) / writeToIntentExtras(Intent).
      static BatchPushPayload payloadFromFirebaseMessage​(com.google.firebase.messaging.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.
      static BatchPushPayload payloadFromReceiverExtras​(android.os.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.
      static BatchPushPayload payloadFromReceiverIntent​(android.content.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.
      void writeToBundle​(android.os.Bundle bundle)
      Serialize this instance into a Bundle.
      Note that you'll need to use payloadFromBundle(Bundle) with the intent's extras to read it back.
      void writeToIntentExtras​(android.content.Intent intent)
      Serialize this instance into an Intent.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • payloadFromReceiverIntent

        public static BatchPushPayload payloadFromReceiverIntent​(@NonNull
                                                                 android.content.Intent intent)
                                                          throws BatchPushPayload.ParsingException
        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(Bundle) / writeToIntentExtras(Intent), you should rather use payloadFromBundle(Bundle)
        Parameters:
        intent - Broadcast receiver intent containing Batch Push data.
        Returns:
        A BatchPushPayload instance.
        Throws:
        BatchPushPayload.ParsingException - Thrown if the argument doesn't contain valid Batch Push data
      • payloadFromReceiverExtras

        public static BatchPushPayload payloadFromReceiverExtras​(@NonNull
                                                                 android.os.Bundle extras)
                                                          throws BatchPushPayload.ParsingException
        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(Bundle) / writeToIntentExtras(Intent), you should rather use payloadFromBundle(Bundle)
        Parameters:
        extras - Broadcast receiver intent's extras containing Batch Push data.
        Returns:
        A BatchPushPayload instance.
        Throws:
        BatchPushPayload.ParsingException - Thrown if the argument doesn't contain valid Batch Push data
      • payloadFromFirebaseMessage

        public static BatchPushPayload payloadFromFirebaseMessage​(@NonNull
                                                                  com.google.firebase.messaging.RemoteMessage remoteMessage)
                                                           throws BatchPushPayload.ParsingException
        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(Bundle) / writeToIntentExtras(Intent), you should rather use payloadFromBundle(Bundle)
        Parameters:
        remoteMessage - Firebase remote message containing Batch Push data.
        Returns:
        A BatchPushPayload instance.
        Throws:
        BatchPushPayload.ParsingException - Thrown if the argument doesn't contain valid Batch Push data
      • writeToBundle

        public void writeToBundle​(@NonNull
                                  android.os.Bundle bundle)
        Serialize this instance into a Bundle.
        Note that you'll need to use payloadFromBundle(Bundle) with the intent's extras to read it back.
        Parameters:
        bundle - Bundle instance to serialize this in
      • writeToIntentExtras

        public void writeToIntentExtras​(@NonNull
                                        android.content.Intent intent)
        Serialize this instance into an Intent. Note that you'll need to use payloadFromBundle(Bundle) with the intent's extras to read it back.
        This method WILL NOT fill the intent in a format that payloadFromReceiverIntent(Intent) understands.
        Parameters:
        intent - Intent instance to serialize this in
      • hasDeeplink

        public boolean hasDeeplink()
        Does this push contains a deeplink
        Returns:
        true if this push contains a deeplink, false otherwise
      • getDeeplink

        public java.lang.String getDeeplink()
        Get the deeplink url contained in this push.
        You should always check if the push contains a deeplink using hasDeeplink()
        Returns:
        the deeplink if any, null otherwise
      • hasCustomLargeIcon

        public boolean hasCustomLargeIcon()
        Does this push contains a custom large icon
        Returns:
        true if this push contains a custom large icon to download, false otherwise
      • getCustomLargeIconURL

        public java.lang.String getCustomLargeIconURL​(android.content.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
        Returns:
        the custom large icon url if any, null otherwise
      • hasBigPicture

        public boolean hasBigPicture()
        Does this push contains a big picture
        Returns:
        true if this push contains a big picture to download, false otherwise
      • getBigPictureURL

        public java.lang.String getBigPictureURL​(android.content.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
        Returns:
        the big picture url if any, null otherwise
      • hasLandingMessage

        public boolean hasLandingMessage()
        Whether the payload contains a landing message or not
      • getLandingMessage

        public BatchMessage getLandingMessage()
        Returns the landing message that's in this payload if there is one.
        Returns:
        the landing message, if there is one
      • getActions

        public java.util.List<BatchNotificationAction> getActions()
        Get the actions associated with this push, if any.
      • getPriority

        @Deprecated
        public int getPriority()
        Deprecated.
        Since Android 8.0, "priority" became "importance", and is now set on the channel itself. You should infer the priority from the channel, using getChannel()
        Get the notification priority

        This integer value is the same one as priorities defined in NotificationCompat

      • getGroup

        public java.lang.String getGroup()
        Get the notification group name. Meant to be used with NotificationCompat.Builder.setGroup(String)
        Returns:
        Group name string, null if none
      • isGroupSummary

        public boolean isGroupSummary()
        Get the notification group name. Meant to be used with NotificationCompat.Builder.setGroupSummary(boolean)
        Returns:
        Whether this notification should be a group summary or not
      • getChannel

        @Nullable
        public java.lang.String getChannel()
        Get the desired notification channel. Meant to be used with NotificationCompat.Builder.setChannelId(String)
        Returns:
        The notification channel this push should be displayed on, if applicable. Can be null.