Push notification is basically an ability of a device to receive information pushed from a server. Although it might seem as something recently invented and modern, it’s not — Short Message Service we all know as SMS has been around for decades, and it’s just an example of a push notification. With the world’s gone mobile, digital product owners and software engineers reinvented the use of push notifications making them a must-have feature literally for any software out there.
Push notifications serve as a channel for instant communication between users and software installed on their devices. They keep users engaged in activities happening with the apps and tuned in to the updates. Altogether, this increases customer loyalty and forms the habit of using certain software on a regular basis. Unlike pop-ups, push notifications are received regardless if the program is running at the moment or being inactive. So, what are the technologies standing behind the push notification mechanisms? And how do they differ for Android and iOS mobile platforms? In this post, we’re breaking down push notifications from A to Z, so if interested in how push notification works, keep reading.
Basic Architecture of Push Notifications Explained
Although push notifications mechanisms are different on Android and iOS, the basic push notification architecture is practically the same for any device. An operating system keeps an ongoing background connection to a server. This connection doesn’t use much power or data as there is no default traffic until an app retracts it from the cloud, so it’s basically unobserved for users. Components that allow third-party app developers to send information from their servers to the user’s devices are called mobile notification services (MNS). Depending on the operating system, this can be Google Cloud Messaging (GCM) for Android and Google Chrome or Apple Push Notification Service (APNS) for iOS correspondingly.
It all starts when a third-party server (belonging to the application owners) sends a message request to a mobile notification service’s (e.g., Google’s GCM) server. Using that background connection we mentioned above, MNS transmits the request to the user’s device. In its turn, an operating system that runs the device checks the received information to correlate it with the installed on the device software and display it via the corresponding application. Push notifications transmitted through the background connection of a device to MNS are very small in size (for example, you can see a subject of email in a push but not the whole letter), so the OS can start a normal connection that requires more power and data to display the whole message.
The advantages of push notifications are many for both users and app developers. From the technical point, supporting an unobserved connection to a centralized mobile notification service mechanism extends battery life and saves data storage uncluttered. At the same time, pushes come with benefits of instant communication, and real-time marketing with some automation options. Centralized mechanisms for push notifications like APNS and GCM allow saving device resources due to the fact they need a single open connection to the network and the OS cloud, as opposed to running all the applications in the background to keep them able to receive and transmit push notifications from their own servers.
Android Push Notifications Mechanism
There are a lot of services that provide push notifications functions for devices powered by the Android operating system. Most of them are basically the Google Cloud Messaging service we’ve already mentioned above with some customizable add-ons over it. Regardless of which service you’d prefer, the architecture and principles of work won’t be any different from GCM. Integrated into an app, it allows sending data from a privately owned server to user’s gadgets as well as receive messages from them on the same connection. GCM use is completely free for app owners, but they have to register with GCM to get access to it.
Google Cloud Messaging feature set covers all the aspects of push messages delivery to custom mobile apps that are installed on target devices. Key opportunities you get when working with GCM include:
- versatile sending of push notifications to the target devices. App owner can divide the users and message to certain groups of devices, single users, and devices following certain topics (in addition to sending pushes to all existing users at once);
- upstream messaging. Google Cloud Messaging allows users to transfer data (from chat messages to acknowledgments and emails) from their devices to the app’s server without splurging the battery life or cached data storage;
- downstream messaging. GCM supports a stable and energy-effective connection the app server and user’s device. It is used for sending alerts and in-chat messages, as well as background processing of information before the user even opened the app.
As for the types of content that can be distributed with GCM, it was originally designed for lightweight short alerts informing users that there’s new data for downloading in the app (like “you have a new message”). Also, GCM transmits messages that require less than 4KB data payload, which means some apps (typically messengers) can display not a notification, but the message as it is, if short enough. Push notifications are prioritized by Google Cloud Messaging service itself.
Push Notifications on iOS
iOS push notification mechanisms aren’t much different from those on the Android operating system. They also can transfer small messages (text & sound). An unusual part here would be the badge count on an app’s icon, which is a default and exclusive feature of iOS. Of course, badge count can be integrated into the Android push notification server as well, but you’d have to go for some custom tools. Push notifications on iOS are powered by Apple Push Notification service (APNs).
Apple Push Notification service is the basis for push notifications delivery on iPhones, iPads, Mac computers, and all the other devices ever released by Apple Inc. It is compatible with iOS, watchOS, tvOS, and macOS devices. The registration of a device with APNs happens automatically once a custom mobile app is installed on a user’s device. Following the registration process, the app owner receives a unique devices token — a key for an app-device combination that identifies a particular application running on a particular device. Token allows push notification provider (be it APNs, GCM or any other solution) to deliver messages only to the devices that were intended to receive them.
After the registration, the push notification system builds an encrypted and stable IP connection between the application server and APNs. After the connection’s been established, the app owner gets access to a setup that enables it sending and receiving notifications. To receive a message, an application doesn’t have to be running, the background connection to the APNs will get and process it anyways. If the device is turned off, APNs would hold on to the push and try to deliver it again later. To start working with APNs, the app owner has to get a provisioning profile and SSL (Secure Sockets Layer) certificate for the server. SSL certificate is a cybersecurity matter necessary for any software that transmits personal information.
Badge Issue with Push Notifications on iOS
A badge is a visual displaying of received push notification in the application installed on a device. It is aimed at alerting the user on the unseen information and unread messages waiting for him. Badges are a great thing to draw user’s attention to what’s new in there, as well as form a habit of using a particular app on a regular basis. However, often instead of bringing the supposed usefulness, badge notifications trick and annoy people. Namely, the number displayed on a badge does not correspond to the real number of unread messages or missed events. Also, the ability of manually clearing the push notification count as it is on the badge does not come by default for iOS apps, you have to go an extra mile to add include this action in the feature set. Seeing the desktop of a device all cluttered with what looks like unread messages that also doesn’t reflect the real state of things is beyond irritating.
So, why does the badge issue appears in the first place? Usually, badge count depends on the app server. When it routes a new push to a device, alongside with that push it also sends a counting number to be added to the badge. Apps store the data on all the unread messages that are waiting on every device and once there’s a new push — +1 point to the visual badge is added. The thing is, it is dependent on iOS developers’ whether the server gets timely updates on user’s action with already received pushes. If the server’s performance isn’t set appropriately, there is no information on the server side about how many messages were actually read. To assure the adequate outlook, the information on users action should be kept up-to-date so that the badge count could decrease the number displayed when needed. All the app developers have to do at this point, is to update the badge count on every separate device and notify the server side as soon as possible.
Cross-Platform Push Notifications Solutions
Firebase Cloud Messaging
Recently, we’ve started seeing a tendency of Google moving from GCM to the use of Firebase Cloud Messaging (FCM) — a cross-platform push notification solution that comes with two ultimate user benefits: reliability and free-of-charge policy. As with the two primary options for Android and iOS we described above, FCM allows notifying clients about new messages, emails or any other fresh data ready to sync. Firebase payload competence equals to standard 4KB.
Firebase can be viewed as a UX tool, it increases users’ experiences with an app drastically.
Firebase performance monitoring — you can see real data from devices for statistics and further improvements. Here are the key capabilities of the Firebase Cloud Messaging platform:
- push notifications for every occasion. With FCM, app owners get access to various types of messages with two primary ones being notification messages (aka display messages) handled automatically and data messages that are managed by client app and have only custom key-value pairs;
- versatile message targeting. Similarly to Google Cloud Messaging, messages can be sent to single devices, groups of devices, and to devices that are following certain topics;
- send messages from the app to the server, not just receive them. The connection between the app’s server and the user’s device established by FCM allows not only receiving messages but sending new ones back (e.g. instant chatting). Also, FCM usage is battery- and data storage-efficient for devices;
- easy device sync. If the user that owns multiple devices opens a push notification on one of them, it disappears on all the others instantly. That way, user actions gets synchronized leading to a better experience.
Implementation path of the Firebase Cloud Messaging consists of the following steps:
- Start with setting up the Firebase SDK. Depending on the platform of your application, the algorithm of actions to do that might differ.
- Arrange the push notifications features in your application. Add handling, topic subscription, and other functions in Notification composer. Push testing available as well.
- Build the notification server architecture. You should create a trusted environment where you’ll generate and send requests. To do that, you can use the Firebase Admin SDK or one of the server protocols to create the push notifying logic.
- Migrate the cloud messaging solution you currently use to the Firebase Cloud Messaging implementation.
Although FCM is a leading solution amongst the cross-platform push notification options, it’s definitely not the only one. If for some reasons the digital tools we reviewed above do not suit your application, we recommend you to check Urban Airship with its 45-day free trial period and Amazon Simple Notification Service with the first million of notifications for free.
Push notification feature in a mobile application isn’t the easiest one to implement, but totally worth all the work it takes. Ongoing user engagement, increase client loyalty, and closer relations between the piece of software and its users are just a few advantages of push messages. We realize that for a non-technical person, this article provokes more questions rather than gives answers. If you’re looking for a push notification solution to fit your app perfectly, you can always ask us which one to choose.