Configuring the Subscription
To Create a Google Cloud Messaging Subscription
- In the FME Server Web User Interface, select Manage > Notifications. Then, select the Subscriptions tab, and click New.
- Provider a name for the Subscription.
- Specify the topics to subscribe to. When the Subscription receives messages from these topics, a GCM notification is sent to the target devices.
- Beside Protocol, specify Google Cloud Messaging.
- 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 |
Demonstration App
FME Alerts is a demonstration app that showcases the capabilities of FME Server using a Google Cloud Messaging subscriber. The app is available for free on the Google Android Apps Store. For more information, see Using the FME Mobile Apps in the FME Knowledge Center.