public final class PushMessage
- Object
- PushMessage
Immutable typed push message used by clients and sending code.
Common fields are provider-independent. Provider-specific options belong
under Builder.platform(String, Map). Received JSON must contain a
supported schema number and is exposed as immutable maps and lists.
Nested types
class PushMessage.Builder | Builds an immutable PushMessage. |
Fields
public static final int SCHEMA_VERSION = 3 | Current JSON envelope schema. |
Methods
Inherited methods
Field details
SCHEMA_VERSION
public static final int SCHEMA_VERSION = 3Current JSON envelope schema.
Method details
builder
public static PushMessage.Builder builder()Creates a message builder initialized with the current schema.
Returns
a new builder
parse
public static PushMessage parse(String json)
throws IOExceptionParses a schema-3 JSON envelope.
Parameters
jsonString- complete JSON object
Returns
an immutable message
Throws
IOException- if JSON is empty, invalid, or has an unsupported schema
getId
public String getId()Returns
the message identifier, or
nullgetTitle
public String getTitle()Returns
the visible notification title, or
nullgetBody
public String getBody()Returns
the visible notification body, or
nullgetImageUrl
public String getImageUrl()Returns
the rich-notification image URL, or
nullgetDeepLink
public String getDeepLink()Returns
the application deep link, or
nullgetCollapseKey
public String getCollapseKey()Returns
the provider collapse key, or
nullgetData
public Map<String, Object> getData()Returns
immutable application data, possibly empty
getSurface
public Map<String, Object> getSurface()Returns
immutable widget or live-surface command data, possibly empty
getPlatformOptions
public Map<String, Object> getPlatformOptions()Returns
immutable provider-specific options keyed by provider
toMap
public Map<String, Object> toMap()Returns
the complete immutable envelope
toJson
public String toJson()Returns
this message encoded as JSON