Push notifications

This section describes how to implement push notification with Genero.

A push notification is a short message sent by a central server entity to an app installed on a mobile device. In order to be notified, the app+device must register itself to a push service (a global service such as Firebase Cloud Messaging), and register also to a push provider (part of the custom application). To indicate that fresh information is available, notifications are sent by push providers to the push service, which broadcasts notifications to registered devices. The apps can then get details about the notification and display a little hint to the end user. Enterprise mobile applications can use push notifications to produce urgent and important updates for users.

Figure: This figure describes the workflow for a push notification (items in yellow are the components that can be implemented with Genero BDL)


Push notification workflow diagram
Workflow:
  1. The app registers to the push service.
  2. The push service generates a unique token to identify the device+app and returns this token to the app.
  3. The app transmits the token to the token maintainer.
  4. The token maintainer stores the new token in a database.
  5. Some event occurs in the global application workflow that requires a push notification to warn all registered devices/apps.
  6. The push provider reads the database for registered tokens.
  7. The push provider sends push notification requests to the push service.
  8. The push service broadcasts the notification messages to all registered devices.

There are several push notification mechanisms available. This chapter covers the Firebase Cloud Messaging (FCM) and Apple Push Notification services (APNs).

Common components can be implemented on the same code base for both FCM and APNs push notification mechanisms: The mobile app and the token maintainer.

The complete source code is available of the FourJSGenero GitHub: https://github.com/FourjsGenero/ex_push_notification