Field | Description |
---|---|
registration_ids |
A string array with the list of devices (registration IDs) receiving the message. It must contain at least 1 and at most 1000 registration IDs. To send a multicast message, you must use JSON. For sending a single message to a single device, you could use a JSON object with just 1 registration id, or plain text (see below). Required. |
collapse_key |
An arbitrary string (such as "Updates Available") that is used to collapse a group of like messages
when the device is offline, so that only the last message gets sent to the
client. This is intended to avoid sending too many messages to the phone when it
comes back online. Note that since there is no guarantee of the order in which
messages get sent, the "last" message may not actually be the last
message sent by the application server. See Advanced Topics for more discussion of this topic. Optional, unless you are using the time_to_live parameter—in that case, you must also specify a collapse_key . |
data |
A JSON object whose fields represents the key-value pairs of the message's payload data. If present, the payload data it will be
included in the Intent as application data, with the key being the extra's name. For instance, "data":{"score":"3x1"} would result in an intent extra named score whose value is the string 3x1 .
There is no limit on the number of key/value pairs, though there is a
limit on the total size of the message (4kb). Note that the values must be enclosed by strings.
If you want to include objects or other non-string data types (such as
integers or booleans), you have to do the conversion to string yourself.
Also note that the key cannot be a reserved word (from or any word starting with google. ). Optional. |
delay_while_idle |
If included, indicates that the message should not be sent immediately
if the device is idle. The server will wait for the device to become active, and
then only the last message for each collapse_key value will be
sent. Optional. The default value is false , and must be a JSON boolean. |
time_to_live |
How long (in seconds) the message should be kept on GCM storage
if the device is offline. Optional (default time-to-live is 4 weeks, and
must be set as a JSON number). If you use this parameter, you must also
specify a collapse_key . |
2012年8月25日 星期六
For JSON, it must contain a string representing a JSON object with the following fields:
string representing a JSON object with the following fields:
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言