public class ParsePush
extends java.lang.Object
ParsePush is a local representation of data that can be sent as a push notification.
The typical workflow for sending a push notification from the client is to construct a new
ParsePush, use the setter functions to fill it with data, and then use
sendInBackground() to send it.| Constructor and Description |
|---|
ParsePush()
Creates a new push notification.
|
ParsePush(ParsePush push)
Creates a copy of
push. |
| Modifier and Type | Method and Description |
|---|---|
void |
clearExpiration()
Clears both expiration values, indicating that the notification should never expire.
|
void |
send()
Sends this push notification while blocking this thread until the push notification has
successfully reached the Parse servers.
|
static <any> |
sendDataInBackground(org.json.JSONObject data,
ParseQuery<ParseInstallation> query)
A helper method to concisely send a push to a query.
|
static void |
sendDataInBackground(org.json.JSONObject data,
ParseQuery<ParseInstallation> query,
SendCallback callback)
A helper method to concisely send a push to a query.
|
<any> |
sendInBackground()
Sends this push notification in a background thread.
|
void |
sendInBackground(SendCallback callback)
Sends this push notification in a background thread.
|
static <any> |
sendMessageInBackground(java.lang.String message,
ParseQuery<ParseInstallation> query)
A helper method to concisely send a push message to a query.
|
static void |
sendMessageInBackground(java.lang.String message,
ParseQuery<ParseInstallation> query,
SendCallback callback)
A helper method to concisely send a push message to a query.
|
void |
setChannel(java.lang.String channel)
Sets the channel on which this push notification will be sent.
|
void |
setChannels(java.util.Collection<java.lang.String> channels)
Sets the collection of channels on which this push notification will be sent.
|
void |
setData(org.json.JSONObject data)
Sets the entire data of the push message.
|
void |
setExpirationTime(long time)
Sets a UNIX epoch timestamp at which this notification should expire, in seconds (UTC).
|
void |
setExpirationTimeInterval(long timeInterval)
Sets the time interval after which this notification should expire, in seconds.
|
void |
setMessage(java.lang.String message)
Sets the message that will be shown in the notification.
|
void |
setPushTime(long time)
Sets a UNIX epoch timestamp at which this notification should be delivered, in seconds (UTC).
|
void |
setQuery(ParseQuery<ParseInstallation> query)
Sets the query for this push for which this push notification will be sent.
|
static <any> |
subscribeInBackground(java.lang.String channel)
Adds 'channel' to the 'channels' list in the current
ParseInstallation and saves it in
a background thread. |
static void |
subscribeInBackground(java.lang.String channel,
SaveCallback callback)
Adds 'channel' to the 'channels' list in the current
ParseInstallation and saves it in
a background thread. |
static <any> |
unsubscribeInBackground(java.lang.String channel)
Removes 'channel' from the 'channels' list in the current
ParseInstallation and saves
it in a background thread. |
static void |
unsubscribeInBackground(java.lang.String channel,
SaveCallback callback)
Removes 'channel' from the 'channels' list in the current
ParseInstallation and saves
it in a background thread. |
public ParsePush()
The default channel is the empty string, also known as the global broadcast channel, but this
value can be overridden using setChannel(String), setChannels(Collection) or
setQuery(ParseQuery). Before sending the push notification you must call either
setMessage(String) or setData(JSONObject).
public ParsePush(ParsePush push)
push.push - The push to copy.public static <any> subscribeInBackground(java.lang.String channel)
ParseInstallation and saves it in
a background thread.channel - The channel to subscribe to.public static void subscribeInBackground(java.lang.String channel,
SaveCallback callback)
ParseInstallation and saves it in
a background thread.channel - The channel to subscribe to.callback - The SaveCallback that is called after the Installation is saved.public static <any> unsubscribeInBackground(java.lang.String channel)
ParseInstallation and saves
it in a background thread.channel - The channel to unsubscribe from.public static void unsubscribeInBackground(java.lang.String channel,
SaveCallback callback)
ParseInstallation and saves
it in a background thread.channel - The channel to unsubscribe from.callback - The SaveCallback that is called after the Installation is saved.public static <any> sendMessageInBackground(java.lang.String message,
ParseQuery<ParseInstallation> query)
message - The message that will be shown in the notification.query - A ParseInstallation query which specifies the recipients of a push.public static void sendMessageInBackground(java.lang.String message,
ParseQuery<ParseInstallation> query,
SendCallback callback)
message - The message that will be shown in the notification.query - A ParseInstallation query which specifies the recipients of a push.callback - callback.done(e) is called when the send completes.public static <any> sendDataInBackground(org.json.JSONObject data,
ParseQuery<ParseInstallation> query)
data - The entire data of the push message. See the push guide for more details on the data
format.query - A ParseInstallation query which specifies the recipients of a push.public static void sendDataInBackground(org.json.JSONObject data,
ParseQuery<ParseInstallation> query,
SendCallback callback)
data - The entire data of the push message. See the push guide for more details on the data
format.query - A ParseInstallation query which specifies the recipients of a push.callback - callback.done(e) is called when the send completes.public void setChannel(java.lang.String channel)
public void setChannels(java.util.Collection<java.lang.String> channels)
public void setQuery(ParseQuery<ParseInstallation> query)
query - A query to which this push should target. This must be a ParseInstallation query.public void setExpirationTime(long time)
setExpirationTimeInterval(long).public void setExpirationTimeInterval(long timeInterval)
public void clearExpiration()
public void setPushTime(long time)
public void setData(org.json.JSONObject data)
setMessage(String).public void setMessage(java.lang.String message)
setData(JSONObject).public <any> sendInBackground()
public void send()
throws ParseException
sendInBackground()
instead of this, unless you are managing your own threading.ParseException - Throws an exception if the server is inaccessible.public void sendInBackground(SendCallback callback)
send(), unless your code is already running from a background thread.callback - callback.done(e) is called when the send completes.