Push Notification Mechanism: Everything You Need to Know

harsmeet Aujla
8 min readJun 19, 2020

--

Introduction:

Push notification is essentially a capacity of a gadget to get data pushed from a server. Despite the fact that it may appear as something as of late developed and current, it's not — Short Message Service we as a whole know as SMS has been around for quite a long time, and it's only a case of a Push notification. With the world's gone versatile, computerized item proprietors and programming engineers rehashed the utilization of Push notification making them an unquestionable requirement have include actually for any product out there.

Push notification fill in as a channel for moment correspondence among clients and programming introduced on their gadgets. They keep clients occupied with exercises occurring with the applications and checked out the updates. Through and through, this builds client devotion and structures the propensity for utilizing certain product all the time. Not at all like pop-ups, Push notification are gotten in any case if the program is running right now or being dormant. All in all, what are the advancements remaining behind the Push notification instruments? Furthermore, how would they contrast for Android and iOS portable stages? In this post, we're separating Push notification from start to finish, so whenever intrigued by how Push notification functions, keep reading.

Basic Architecture of Push Notifications Explained:

In spite of the fact that push notifications systems are distinctive on Android and iOS, the essential push warning engineering is for all intents and purposes the equivalent for any gadget. A working framework keeps a continuous foundation association with a server. This association doesn’t utilize a lot of intensity or information as there is no default traffic until an application withdraws it from the cloud, so it’s fundamentally in secret for clients. Segments that permit outsider application engineers to send data from their servers to the client’s gadgets are called versatile notice administrations (MNS). Contingent upon the working framework, this can be Google Cloud Messaging (GCM) for Android and Google Chrome or Apple Push Notification Service (APNS) for iOS correspondingly.

Everything begins when an outsider server (having a place with the application proprietors) communicates something specific solicitation to a versatile warning assistance’s (e.g., Google’s GCM) server. Utilizing that foundation association we referenced above, MNS transmits the solicitation to the client’s gadget. In its turn, a working framework that runs the gadget checks the got data to associate it with the introduced on the gadget programming and show it by means of the relating application. Push notifications transmitted through the foundation association of a gadget to MNS are extremely little in size (for instance, you can see a subject of email in a push however not the entire letter), so the OS can begin a typical association that requires more force and information to show the entire message.

The benefits of push notifications are numerous for the two clients and application designers. From the specialized point, supporting an in secret association with an incorporated versatile notice administration component expands battery life and spares information stockpiling uncluttered. Simultaneously, pushes accompany advantages of moment correspondence, and ongoing advertising with some robotization alternatives. Unified instruments for push notifications like APNS and GCM permit sparing gadget assets because of the reality they need a solitary open association with the system and the OS cloud, instead of running all the applications out of sight to keep them ready to get and transmit push notifications from their own servers.

Firebase Cloud Messaging (FCM):

In 2014, Google acquired Firebase. Subsequently, they replaced Google Cloud Messaging (GCM) with Firebase Cloud Messaging (FCM), announcing it to be the successor of GCM.

FCM provides new functionality:

- An intuitive notifications interface in the Firebase console
- Improved reporting
- Native integrations with other Firebase products including A/B Testing (to find out which message brings more conversions) and Predictions (to tailor notifications to people based on their expected behavior)

FCM helps you inform a client app that incoming data (e.g. a new message) is ready to sync. In the case of instant messaging, a message can transmit a payload not exceeding 4KB.

To implement FCM, you’ll need two key components:

1. A trusted environment like Cloud Functions for Firebase or an app server that allows you to create, target, and forward messages
2. An iOS or Android client application for accepting messages

Messages can be sent by means of the Firebase Admin SDK or the FCM server protocols. The notifications composer is used for testing and sending messages. It provides built-in targeting and analytics. FCM helps you send notifications and messages to iOS and Android free of charge.

Android Push Notifications Mechanism:

There are a ton of administrations that give push notifications capacities to gadgets fueled by the Android working framework. The majority of them are fundamentally the Google Cloud Messaging administration we’ve just referenced above with some adaptable additional items over it. Notwithstanding which administration you’d like, the design and standards of work won’t be any not the same as GCM. Incorporated into an application, it permits sending information from an exclusive server to client’s contraptions just as get messages from them on a similar association. GCM use is totally free for application proprietors, however they need to enlist with GCM to gain admittance to it.

Google Cloud Messaging highlight set covers all the parts of push messages conveyance to custom versatile applications that are introduced on track gadgets. Key open doors you get when working with GCM include:

  1. Flexible sending of push notifications to the objective gadgets:

Application proprietor can partition the clients and message to specific gatherings of gadgets, single clients, and gadgets following certain subjects (notwithstanding sending pushes to every single existing client without a moment’s delay);

2. Upstream informing:

Google Cloud Messaging permits clients to move information (from talk messages to affirmations and messages) from their gadgets to the application’s server without binge spending the battery life or reserved information stockpiling;

3. Downstream informing:

GCM underpins a stable and vitality successful association the application server and client’s gadget. It is utilized for sending cautions and in-talk messages, just as foundation preparing of data before the client even opened the application.

Concerning the kinds of substance that can be conveyed with GCM, it was initially intended for lightweight short cautions educating clients that there’s new information for downloading in the application (like “you have another message”). Additionally, GCM transmits messages that require under 4KB information payload, which implies some applications (ordinarily couriers) can show not a notice, yet the message all things considered, if sufficiently short. Push notifications are organized by Google Cloud Messaging administration itself.

How do Push Notifications Work?

To understand how mobile push notifications work in action, let’s get three basic terminologies right

Client app– The app which receives the push notification.

App server– To be able to send push notification to the users who have installed your app, you have to create an app server. This server sends the message to the GCM (discussed later) which then transmits it to the client app.

Now, setting up the app server is secondary when you think of launching a push campaign. The things that matter are segmentation, triggered messaging, workflow set-up and hundred other things, building which would drain your tech resource unless you are Facebook, Amazon or something alike.

This is why there exist products like WebEngage that provide push notification engine as a service. Suppose you are using WebEngage, so the App server that we discussed in the above point would be provided by WebEngage.

Web-engage (insert your third party app server’s name) Client SDK– This is a piece of code that client adds to its app to integrate it with Web-engage.

That’s it. Now, let’s understand the flow end to end.

  • To be able to receive push notifications, the app must be configured and registered with a Push Notification Service Provider. The most widely used service provider globally is GCM (Google Cloud Messaging), or FCM (Firebase Cloud Messaging), a Google-run entity. FCM is the advanced version of GCM with additional features. Then there is APNS run by Apple for iOS. Registration with GCM provides you with an API key that will be used in the next step.Contrary to the expectation, Apple devices don’t necessarily need to configure with just APNS to receive a push notification. Even GCM can send notifications to iOS devices. All you have to do is upload your APNS certificate to GCM.
  • Once the client has configured with GCM, whenever a user installs the client app, GCM issues a unique registration id to this app-device combination. This registration is required so that the app can receive push notifications from GCM.
  • After the device registration, an equivalent app server identification is needed. This is required so that the app server can send notifications to the user’s device on the client’s behalf. This server identification is done using an API key in case of GCM/FCM, and a certificate in case of APNS.
  • Now, the registration id that we generated in #2 is unique to every app. GCM and app server identify this id to send notifications, therefore, it must be kept secret so that it is not misused.
  • When the user launches the app for the first time, WebEngage’s client SDK sends this registration id to WebEngage’s servers. The same id is thereafter used by WebEngage to send push notifications.
  • Now, a Push notification message is nothing but a piece of data called payload (4kb size in Android, 2k in iOS) which looks something like this.

Registering with FCM:

FCM lets you forward pushes directly from the Firebase console, with an app server or other trusted environment supporting the server logic. Devices exchange pushes with the help of a notification key by sending notifications to the server. This ensures synchronization of actions, such as alerts, across multiple mobile devices. But to do that, the app needs to register with FCM first:

1. The client app transmits the sender ID, API Key, and App ID to FCM.

2. FCM returns a registration token to the client app.

3. The client app then sends the registration token to the app server.

Push notifications behavior

The behavior of Firebase notifications depends on the foreground/background state of the receiving application. You can learn about receiving messages in an Android app here.

Keep in mind that push notification behavior also depends on devices. For example, push notifications not coming through is a common issue on Xiaomi phones unless notifications are manually whitelisted in the device’s settings.

References:

  1. https://www.quora.com/How-do-push-notifications-work-What-is-the-basic-concept-behind-them
  2. https://idapgroup.com/blog/push-notifications-mechanism-for-ios-android/#:~:text=Basic%20Architecture%20of%20Push%20Notifications,background%20connection%20to%20a%20server.
  3. https://blog.scalefusion.com/all-that-you-want-to-know-about-apple-push-notification-service-apns/

--

--

No responses yet