Push Notifications Overview
This chapter introduces Push Notifications. It contains the following sections:
Push Notifications Background
The Ensemble Push Notifications feature make it possible for an Ensemble production to send push notification messages to iOS and Google devices. This feature makes it possible to easily send notifications to a user with an app running on multiple devices. Your code can send notifications without having to be aware of the number of devices or whether the devices are iOS or Google devices.
Push notifications are typically used to:
Inform the user that an asynchronous request has finished and data is available.
Inform the user that a workflow reached a point which requires the user to take an action.
Raise awareness and ask the user to use the app or a feature of the app.
Ensemble supports the following push notification protocols:
iOS Push Notifications (APNS)
Google Cloud Messaging (GCM)
The Push Notifications feature allows an Ensemble production to initiate a notification that notifies the user on a mobile device. For example, an app can provide mobile device access to a system built on Ensemble. In most cases, the mobile app user is initiating actions, either querying to get information or adding or updating data. But in some cases, the Ensemble production initiates the action to notify the mobile device user of some event or condition. The Push Notifications feature enables the Ensemble code to initiate the action and does not depend on the user actively using the app at the time the push notification is sent..
The push notifications protocols do not guarantee that a message will be delivered. Consequently, you should not use these protocols to send important data, but rather to notify the user that the data is available. The user is responsible for initiating an action based on the notification.
In order to enable push notifications, the mobile app registers with the APNS or GCM server and gets a token that identifies the app running on a specific device. The mobile app must also enable push notifications with the device operating system. The details for these operations are different for the APNS and GCM protocols. You can develop the app using any technology available on the device. You can but do not have to use InterSystem’s Zen Mojo to create mobile applications. Note that to use push notifications, the mobile app needs to either be a native app or be a hybrid web app and have a native component. A pure web app cannot use push notifications. For information on hybrid applications in Zen Mojo, see Kinds of Zen Mojo Applications in Using Zen Mojo.
Ensemble’s Push Notification allows your Ensemble production to push notifications to a user. If the user has multiple devices the notifications will be sent to all devices. Your code sending the notifications does not need to be aware of whether the user has multiple devices and whether the devices use the APNS or GCM protocols. Your code can send a single notifications to multiple devices for a user. The Push Notifications Identity Manager makes this possible.
The app running on the mobile device makes a call to your Ensemble SOAP or REST service, which registers the app and device with the Identity Manager. It associates a string identifier with the app on the mobile device. You can choose any kind of identifier. For example, you can use the account that identifies the user on your Ensemble production application. You can register multiple devices using the same identifier. When you register the device, you must provide the information required by the APNS or GCM servers to push a notification to the device.
Once one or more devices have been registered with an identifier, your Ensemble code can push a notification by sending a notification message to the Identity Manager with the user’s identification. The Identity Manager sends the notifications through a router to one or more Push Notifications operations.
The following illustrates how an app on a mobile device registers with the Push Notifications Identity Manager.
The following illustrates how push notifications are sent to the app on the mobile device. The Identity Manager, GCM Operation, and APNS Operation are provided as built-in components. You can define a router using the Routing Engine and a routing rule.
Push Notifications Operations
Ensemble provides built-in business operations for Push Notifications. These operations enable you to push a notification to an app on an iOS or Google device. The operations are:
EnsLib.PushNotifications.APNS.OperationOpens in a new tab—Business operation that sends the push notifications to the iOS Push Notifications server. Each target app requires an SSL certificate. The operation maintains a connection to the APNS server for that certificate. Calls the underlying %Net.PushNotifications.APNSOpens in a new tab class to send the motification to the APNS server.
EnsLib.PushNotifications.GCM.OperationOpens in a new tab—Business operation that sends the push notification to the Google Cloud Messaging server. Calls the underlying %Net.PushNotifications.GCMOpens in a new tab class to send the notification to the GCM server. The GCM operation can send a single notification to multiple devices for the same user and app.
Push Notifications Identity Manager
The Identity Manager allows you to send a push notification to a user without knowing the number or kind of devices that the user has. The Push Notifications Identity Manager maintains a table associating a single ID for a user of a mobile app and associates it with all of the user’s mobile devices. The Identity Manager business process receives messages from other Ensemble production components. It, typically, sends messages to a router that forwards all GCM messages to the GCM operation and forwards each APNS message to the APNS operation configured to handle the specified SSL certificate.
Sending Push Notifications from ObjectScript
If you are sending Push Notifications from an Ensemble production component, you can send the notification to the Identity Manager or directly to one of the Push Notifications operations. However, if you are generating your Push Notifications in ObjectScript outside of the Ensemble production environment, you can use the Push Notifications AppService to get the notification into the Ensemble environment. This allows you to use the capabilities of the Identity Manager. Note that if you are not using the Identity Manager, your code could also use the %Net.PushNotifications.APNSOpens in a new tab and %Net.PushNotifications.GCMOpens in a new tab classes directly.