Configuring the Subscription
To Create a Google Cloud Messaging Subscription
- In the FME Server Web User Interface, select Notifications > Subscriptions, and click New.
- Provider a name for the Subscription.
- Beside Protocol, specify Google Cloud Messaging.
- Specify the Topics you want to subscribe to using the drop-down selector. To create a topic and use it right away, click +. When the Subscription receives messages from these topics, a GCM notification is sent to the target devices.
- Specify the Google Cloud Messaging fields for the Subscription (see below).
- Click OK to create the Subscription.
Google Cloud Messaging Field | Description |
---|---|
API Key | The developer API key, used for authorizing the subscription to the Google Cloud Messaging service. |
Registration IDs |
The list of target Android devices to receive notifications. Use a comma to separate multiple devices. Note: This field is primarily for testing purposes. To override this field in a production system, see below. |
Collapse Key | An arbitrary string that is used to collapse multiple, similar messages when a device is offline, so that only the last message is sent. For example, if 100 messages with the same Collapse Key are sent to a device with Registration ID "2" while it is turned off, the device will only receive the last message once it is turned on. |
Notification Content Template | The notification content template. |
Overriding Behavior Using Notification Keywords
By default, a Google Cloud Messaging configuration allows for delivery of notifications to a fixed set of Android devices, with its message formatted by the prescribed content template. The Google Cloud Messaging subscriber also allows you to specificy target Android devices and message format in the incoming notification. The notification keywords that enable this overriding behavior are gcm_token
and subscriber_content
.
gcm_token
—Overrides the Registration IDs field in a Google Cloud Messaging subscription. Use a comma to separate multiple devices.gcm_collapse_key
—Overrides the Collapse Key field.subscriber_content
—Overrides the Content Template field.
Examples
The following Google Cloud Messaging Subscriber examples are based on this default configuration:
Registration IDs |
123456,abcdef |
Content Template |
Message: {msg} |
Notification | Target Device(s) | Message Sent to Device(s) |
---|---|---|
{ "msg" : "Hello, world" } |
123456 abcdef |
Message: Hello, world |
{ "gcm_token" : "987654,fefefe", "msg" : "Hello, device" } |
987654 fefefe |
Message: Hello, device |
{ "subscriber_content" : "Alert", "msg" : "Ignored" } |
123456 abcdef |
Alert |