Developing User Notifications in iOS
Prior to iOS 10, user notifications are plain and simple. No rich graphics or media. It is just in text format. Depending on the user's context, the notification can appear on the lock screen or home screen. If the user misses any of the notifications, they can bring up the Notification Center to reveal all pending notifications.
Since the release of iOS 10, Apple has revamped the notification system to support user notifications in rich content and custom notification UI. By rich content, it means you can include static images, animated GIFs, videos, and audios in the notifications. Figure 30-2 gives you an idea of the new notifications.
You may have heard of push notifications, which have been widely adopted in messaging apps. Actually, user notifications can be classified into two types: local notifications and remote notifications. Local notifications are triggered by the application itself and contained on the user's device. For example, a location-based application will send users a notification when they are in a particular area. Or a to-do list app displays a notification when an item is close to the due date.
Remote notifications are usually initiated by server side applications that reside on remote servers. When the server application wants to send messages to users, it sends a notification to Apple Push Notification Service (or APNS for short). The service then forwards the notification to users' devices.
We're not going to talk about the implementation of remote notifications in this chapter. Instead, we will focus on discussing local notifications, and show you how to use the new User Notifications framework to implement the rich-content notifications.
To access the full version of the book, please get the full copy here. You will also be able to access the full source code of the project.