A push notification (PN) is a text message that appears on a mobile device and that is related to an app that is installed on the device. When a PN is received on the device, the user does not need to be using the app or even using the device. All that is required is that the device be switched on. PNs thus provide a way for app publishers to communicate directly to users, without having to wait for the app to be started or to get lined up among incoming messages. PNs typically provide information, such as update news related to the app, but can also be used to drive actions, such as accepting invitations, linking to a website, or modifying a database.
In MobileTogether, a PN is sent from a MobileTogether solution on one device and is received by the same solution (or another solution) on other devices. The notification is thus "pushed out" from one solution to multiple devices. The screenshot below shows how a PN is sent from a sending solution to receiving solutions, with the recipients in this case being identified on the basis of an external PN key (other methods for identifying recipient devices are also available).
PNs can also be sent by MobileTogether AppStore Apps—which are MobileTogether solutions that have been compiled as apps that can be downloaded from app stores—to other MobileTogether AppStore Apps.
How MobileTogether push notifications work
MobileTogether PNs consist of a short message, a big message, and a payload consisting of data structured as key–value pairs. Typically, the short message is what is displayed on the device when the PN is received; on tapping the PN, the big message is displayed; the messages can have buttons, which allows the user to determine what action to take when the message is received. The payload of the PN is transferred to a data tree on the device and can be used by other actions; this enables new data—data that is related to the PN event—to be freely processed by the whole range of MobileTogether actions and used with MobileTogether controls.
Broadly, the push notification mechanism works as follows:
•A Send Push Notification action of the sending solution defines the PN's main parameters (message details and list of receivers). This part of the mechanism is broadly defined in The Sending Solution sub-section of this section.
•Receiving devices are identified on the basis of either their login credentials or their registration. A device is logged in to a particular MobileTogether Server with a specific user name. Additionally, a device can be registered (i) with an external PN key, and/or (ii) to receive specific PN topics. In the Send Push Notification action, there is a setting that allows receiving devices to be defined on the basis of their user name, their external PN key, or the PN's topic. Because of this, a PN can be sent to a list of receivers that can be flexibly configured.
•When a PN is received on a device, its short/big messages can be displayed and its payload is automatically transferred to the \$MT_PUSHNOTIFICATION page source of the receiving solution. The receiving solution defines what additional action/s to take when the PN is received and if the user taps one of the PN's buttons. The sub-section The Receiving Solution provides an overview of this part of the PN mechanism.
In this section
While The Sending Solution and The Receiving Solution sub-sections together describe the main PN mechanism, the two sub-sections that follow them deal with additional features. In order to successfully implement PNs in AppStore Apps (apps that are compiled from MobileTogether solutions), some additional steps are required; these steps are described in the Push Notifications in AppStore Apps sub-section. Simulating Push Notifications explains how to simulate PNs when the sending and receiving solutions are not one and the same solution.