We all know about notifications, right? Those things you turn off the instant you install a new game on your device or you wish to shut down a WhatsApp group. The issue is that most people consider these data streams as mere "messages", but there's actually a lot more than that. Follow me inside to discover what a push notification really is. I'll start from the basics, so you'll able to tell your clients that it's not only marketing.
First, I'd like to explain to you the meaning of the verb "push", which obviously differs from the verb "pull", but not only in the English language, also in computing. Pushing means that "something" (a data object, a message...) is being sent (pushed) from a server or an online service to a specific device. Pulling means that this device asks for that data object, and the server provides it (is being pulled) to the device as a result of a request.
Once you understand how this all works, everything will be much simpler as it's a core concept in the development of an app with push messages. So, remember that they ARE NOT those little pop-ups that appear on your phone! These are "notifications" and are the result of receiving a push message. A push notification can be described as a notification triggered by the arrival of a push message.
How does your server know who to send a push message to? Easy, with magic!
Jokes aside, the most used system is the pub/sub method. You should subscribe users' devices to a specific "topic", which can be seen as a public or personal space featuring a specific topic. In this case, the concept of "topic" may be tricky, so I'll try to make it as clear as possible. A topic may be a single device (represented, for example, by the device_id) or a sort of group including many devices sharing the interest in a particular topic, like "sports news". In the first case, only one specific device will receive the push message as it'll be the only one registered to the topic "2131danoijfsdko34". In the second case, there will be a lot more devices as they subscribe to a group of people interested in the NBA or Soccer.
The two OSs have different ways to handle push messages.
iOS uses APNs as primary service, but can also use Firebase Cloud Messaging. And notifications are only handled by the OS unless you use a Notification Service Extension (the infamous UNNotificationServiceExtension). iOS supports push notifications with audio, videos, and images with that extension. Plus, any iOS user knows that the OS needs to ask them permission to send them notifications.
Android uses Firebase Cloud Messaging as primary service and has two ways to create notifications:
- Notification messages are automatically displayed to end-users' devices on behalf of the client app. Notification messages have a predefined set of user-visible keys and an optional data payload of custom key-value pairs.
- Data messages need to be created by the client that receives the push and have only custom key-value pairs with no reserved key names.
Plus, Android doesn't need to ask users' permission to send them notifications. It depends on how you wish to implement them. Google's OS gives you a bit more freedom, but you need to work harder if you want to customize notifications using data messages. Android supports push notifications with text, images, and audio, but not by default. So, you should implement your own logic if you want to achieve the best result.
Needless to say, implementing a push strategy is very important if you want to do marketing campaigns or just notify users once in a while. Here's some advice:
- Avoid annoying users with too many notifications, or else users will certainly disable them. Make them relevant. And don't make the mistake of sending too few notifications either!
- On Android devices, allow users to enable/disable notifications in a settings page, without needing to visit the app information section. This way it'll be easier for users to disable them, it's true. But they'll also thank you.
- Link your notifications to app parts, nobody wants to see a sale notification that brings you on the home screen. Accompany users to the desired screen.
- In messaging apps, exploit the power of grouping and quick answers. People will absolutely love it!
Ok, now you know how to explain to anyone what a push notification is. Make sure to get things right and suggest your clients do the same. It's not that hard, but you could make mistakes if you neglect the simple concepts you've just learned.