public class

PushMessage

extends Object
implements Parcelable JsonSerializable
java.lang.Object
   ↳ com.urbanairship.push.PushMessage

Class Overview

A push message, usually created from handling a message intent from either GCM, or another push notification service

Summary

Constants
String EXTRA_ACTIONS The actions extra key holds the payload of actions to be performed with the push.
String EXTRA_ALERT The alert extra holds the string sent in the "alert" field of an Urban Airship Push Notification.
String EXTRA_CATEGORY The extra key for the category of the notification.
String EXTRA_DELIVERY_PRIORITY The extra key for the delivery priority.
String EXTRA_EXPIRATION The EXPIRATION extra is a time expressed in seconds since the Epoch after which, if specified, the notification should not be delivered.
String EXTRA_ICON The extra key indicates the name of an icon to use from an app's drawable resources.
String EXTRA_ICON_COLOR The extra key indicates the icon color.
String EXTRA_INTERACTIVE_ACTIONS The extra key for the payload of Urban Airship actions to be run when an interactive notification action button is opened.
String EXTRA_INTERACTIVE_TYPE The extra key for the interactive notification group that will be displayed with a push.
String EXTRA_IN_APP_MESSAGE The extra key for the the legacy in-app message payload.
String EXTRA_LOCAL_ONLY The extra key indicates if the notification should only be displayed on the device.
String EXTRA_METADATA The push metadata extra holds the encrypted push identifiers sent in an Urban Airship Push Notification.
String EXTRA_NOTIFICATION_CHANNEL The extra key for the channel to be used when posting a notification.
String EXTRA_NOTIFICATION_TAG The extra key for the tag to be used when posting a notification.
String EXTRA_PRIORITY The extra key for the priority of the notification.
String EXTRA_PUBLIC_NOTIFICATION The extra key for the public notification payload.
String EXTRA_PUSH_ID The push ID extra is the ID assigned to a push at the time it is sent.
String EXTRA_RICH_PUSH_ID The rich push extra that contains the rich push message ID.
String EXTRA_SEND_ID The push ID extra holds the unique push ID sent in an Urban Airship Push Notification.
String EXTRA_SOUND The extra key for the sound of the notification.
String EXTRA_STYLE The extra key for the style of the notification.
String EXTRA_SUMMARY The extra key for the summary of the notification.
String EXTRA_TITLE The extra key for the title of the notification.
String EXTRA_VISIBILITY The extra key for the notification's visibility in the lockscreen.
String EXTRA_WEARABLE The extra key for the wearable payload.
String PRIORITY_HIGH Constant for the extra EXTRA_DELIVERY_PRIORITY that indicates the push is high priority.
[Expand]
Inherited Constants
From interface android.os.Parcelable
Fields
public static final Creator<PushMessage> CREATOR Parcel Creator for push messages.
Public Constructors
PushMessage(Bundle pushBundle)
Create a new PushMessage
PushMessage(Map<StringString> data)
Create a new PushMessage
Public Methods
boolean containsAirshipKeys()
Checks the message for Urban Airship keys.
boolean containsKey(String key)
Checks if the push message contains a key.
int describeContents()
boolean equals(Object o)
static PushMessage fromJsonValue(JsonValue jsonValue)
Creates a push message from a json value.
Map<StringActionValue> getActions()
Gets the push message's actions.
String getAlert()
Gets the notification alert
String getCanonicalPushId()
Gets the message's canonical push ID
String getCategory()
Gets the category of the notification.
String getExtra(String key, String defaultValue)
Gets an extra from the push bundle.
int getIcon(Context context, int defaultIcon)
Gets the notification icon image.
int getIconColor(int defaultColor)
Gets the notification icon color.
String getInteractiveActionsPayload()
Gets the notification actions payload.
String getInteractiveNotificationType()
Gets the notification action button type.
String getMetadata()
Gets the push send metadata.
String getNotificationChannel()
Returns the notification channel that should be used when posting the notification.
String getNotificationTag()
Returns the notification tag that should be used when posting the notification.
int getPriority()
Gets the priority of the notification.
String getPublicNotificationPayload()
Gets the public notification payload.
Bundle getPushBundle()
Returns a bundle of all the push extras
String getRichPushMessageId()
Gets the rich push message ID
String getSendId()
Gets the push send ID
Uri getSound(Context context)
Gets the sound of the notification.
String getStylePayload()
Gets the style payload of the notification.
String getSummary()
Gets the summary of the notification.
String getTitle()
Gets the title of the notification.
int getVisibility()
Gets the visibility of the notification for the lockscreen.
String getWearablePayload()
Gets the wearable payload.
int hashCode()
boolean isLocalOnly()
Checks if the notification should only be displayed on the device.
JsonValue toJsonValue()
Returns the objects represented as a JsonValue.
String toString()
void writeToParcel(Parcel dest, int flags)
[Expand]
Inherited Methods
From class java.lang.Object
From interface android.os.Parcelable
From interface com.urbanairship.json.JsonSerializable

Constants

public static final String EXTRA_ACTIONS

The actions extra key holds the payload of actions to be performed with the push.

Constant Value: "com.urbanairship.actions"

public static final String EXTRA_ALERT

The alert extra holds the string sent in the "alert" field of an Urban Airship Push Notification.

Constant Value: "com.urbanairship.push.ALERT"

public static final String EXTRA_CATEGORY

The extra key for the category of the notification.

Constant Value: "com.urbanairship.category"

public static final String EXTRA_DELIVERY_PRIORITY

The extra key for the delivery priority.

Constant Value: "com.urbanairship.priority"

public static final String EXTRA_EXPIRATION

The EXPIRATION extra is a time expressed in seconds since the Epoch after which, if specified, the notification should not be delivered. It is removed from the notification before delivery to the client. If not present, notifications may be delivered arbitrarily late.

Constant Value: "com.urbanairship.push.EXPIRATION"

public static final String EXTRA_ICON

The extra key indicates the name of an icon to use from an app's drawable resources.

Constant Value: "com.urbanairship.icon"

public static final String EXTRA_ICON_COLOR

The extra key indicates the icon color.

Constant Value: "com.urbanairship.icon_color"

public static final String EXTRA_INTERACTIVE_ACTIONS

The extra key for the payload of Urban Airship actions to be run when an interactive notification action button is opened.

Constant Value: "com.urbanairship.interactive_actions"

public static final String EXTRA_INTERACTIVE_TYPE

The extra key for the interactive notification group that will be displayed with a push.

Constant Value: "com.urbanairship.interactive_type"

public static final String EXTRA_IN_APP_MESSAGE

The extra key for the the legacy in-app message payload.

Constant Value: "com.urbanairship.in_app"

public static final String EXTRA_LOCAL_ONLY

The extra key indicates if the notification should only be displayed on the device.

Constant Value: "com.urbanairship.local_only"

public static final String EXTRA_METADATA

The push metadata extra holds the encrypted push identifiers sent in an Urban Airship Push Notification. Possible data includes send, push, and group IDs.

Constant Value: "com.urbanairship.metadata"

public static final String EXTRA_NOTIFICATION_CHANNEL

The extra key for the channel to be used when posting a notification.

Constant Value: "com.urbanairship.notification_channel"

public static final String EXTRA_NOTIFICATION_TAG

The extra key for the tag to be used when posting a notification.

Constant Value: "com.urbanairship.notification_tag"

public static final String EXTRA_PRIORITY

The extra key for the priority of the notification. Acceptable values range from PRIORITY_MIN (-2) to PRIORITY_MAX (2).

Defaults to 0.

Constant Value: "com.urbanairship.priority"

public static final String EXTRA_PUBLIC_NOTIFICATION

The extra key for the public notification payload.

Constant Value: "com.urbanairship.public_notification"

public static final String EXTRA_PUSH_ID

The push ID extra is the ID assigned to a push at the time it is sent. Each API call will result in a unique push ID, so all notifications that are part of a multicast push will have the same push ID.

Constant Value: "com.urbanairship.push.CANONICAL_PUSH_ID"

public static final String EXTRA_RICH_PUSH_ID

The rich push extra that contains the rich push message ID.

Constant Value: "_uamid"

public static final String EXTRA_SEND_ID

The push ID extra holds the unique push ID sent in an Urban Airship Push Notification. This is most commonly referred to as the "Send ID" at Urban Airship.

Constant Value: "com.urbanairship.push.PUSH_ID"

public static final String EXTRA_SOUND

The extra key for the sound of the notification.

Constant Value: "com.urbanairship.sound"

public static final String EXTRA_STYLE

The extra key for the style of the notification.

Constant Value: "com.urbanairship.style"

public static final String EXTRA_SUMMARY

The extra key for the summary of the notification.

Constant Value: "com.urbanairship.summary"

public static final String EXTRA_TITLE

The extra key for the title of the notification.

Constant Value: "com.urbanairship.title"

public static final String EXTRA_VISIBILITY

The extra key for the notification's visibility in the lockscreen. Acceptable values are: VISIBILITY_PUBLIC (1), VISIBILITY_PRIVATE (0) or VISIBILITY_SECRET (-1).

Constant Value: "com.urbanairship.visibility"

public static final String EXTRA_WEARABLE

The extra key for the wearable payload.

Constant Value: "com.urbanairship.wearable"

public static final String PRIORITY_HIGH

Constant for the extra EXTRA_DELIVERY_PRIORITY that indicates the push is high priority.

Constant Value: "high"

Fields

public static final Creator<PushMessage> CREATOR

Parcel Creator for push messages.

Public Constructors

public PushMessage (Bundle pushBundle)

Create a new PushMessage

Parameters
pushBundle The intent extras for the push

public PushMessage (Map<StringString> data)

Create a new PushMessage

Parameters
data The push data.

Public Methods

public boolean containsAirshipKeys ()

Checks the message for Urban Airship keys.

Returns
  • true if the message contains any Urban Airship keys.

public boolean containsKey (String key)

Checks if the push message contains a key.

Parameters
key The key to check.
Returns
  • true if the push message contains a value at the key, otherwise false.

public int describeContents ()

public boolean equals (Object o)

public static PushMessage fromJsonValue (JsonValue jsonValue)

Creates a push message from a json value.

Parameters
jsonValue The json value.
Returns
  • The push message.

public Map<StringActionValue> getActions ()

Gets the push message's actions.

Returns
  • A map of action name to action value.

public String getAlert ()

Gets the notification alert

Returns
  • The notification alert.

public String getCanonicalPushId ()

Gets the message's canonical push ID

Returns
  • The canonical push ID

public String getCategory ()

Gets the category of the notification.

Returns
  • The category of the notification.

public String getExtra (String key, String defaultValue)

Gets an extra from the push bundle.

Parameters
key The extra key.
defaultValue Default value if the value does not exist.
Returns
  • The extra or the default value if the extra does not exist.

public int getIcon (Context context, int defaultIcon)

Gets the notification icon image.

Returns
  • The integer resource of the icon image.

public int getIconColor (int defaultColor)

Gets the notification icon color.

Returns
  • The color of the icon.

public String getInteractiveActionsPayload ()

Gets the notification actions payload.

Returns
  • The notification actions payload.

public String getInteractiveNotificationType ()

Gets the notification action button type.

Returns
  • The interactive notification type.

public String getMetadata ()

Gets the push send metadata.

Returns
  • The push send metadata.

public String getNotificationChannel ()

Returns the notification channel that should be used when posting the notification.

Returns
  • Either the notification channel or null if the channel is not available.

public String getNotificationTag ()

Returns the notification tag that should be used when posting the notification.

Returns
  • Either the notification tag or null if the tag is not available.

public int getPriority ()

Gets the priority of the notification.

Defaults to 0.

Returns
  • The priority of the notification.

public String getPublicNotificationPayload ()

Gets the public notification payload.

Returns
  • The public notification payload.

public Bundle getPushBundle ()

Returns a bundle of all the push extras

Returns
  • A bundle of all the push extras

public String getRichPushMessageId ()

Gets the rich push message ID

Returns
  • The rich push message ID, or null if its unavailable.

public String getSendId ()

Gets the push send ID

Returns
  • The push send Id.

public Uri getSound (Context context)

Gets the sound of the notification.

Parameters
context The application context.
Returns
  • The sound of the notification.

public String getStylePayload ()

Gets the style payload of the notification.

Returns
  • The style payload of the notification.

public String getSummary ()

Gets the summary of the notification.

Returns
  • The summary of the notification.

public String getTitle ()

Gets the title of the notification.

Returns
  • The title of the notification.

public int getVisibility ()

Gets the visibility of the notification for the lockscreen.

Defaults to 1 (VISIBILITY_PUBLIC).

Returns
  • The visibility of the notification for the lockscreen.

public String getWearablePayload ()

Gets the wearable payload.

Returns
  • The wearable payload.

public int hashCode ()

public boolean isLocalOnly ()

Checks if the notification should only be displayed on the device.

Returns
  • true if the notification should only be displayed on the device, otherwise false

    Defaults to false.

public JsonValue toJsonValue ()

Returns the objects represented as a JsonValue.

Returns
  • The object as a JsonValue.

public String toString ()

public void writeToParcel (Parcel dest, int flags)