Notifications give people information and functionality that’s important right now. People can get notifications in various contexts, such as on the lock screen, while they’re using apps, and when they visit Notification Center.
Notification Center has two views: Today and Notifications
The Today view displays an editable list of widgets. A Today widget is an app extension that displays a small amount of timely, high-value information or functionality that’s provided by an app the user cares about. For example, the Calendar widget displays only today’s events. Tapping an event in the Calendar widget opens that event in the Calendar app, where users can edit the event and manage other events.
The Notifications view displays recent notification items from apps that users are interested in. Users can visit an app’s area in Settings to specify whether they want notifications from the app to appear in Notification Center.
iOS apps can use notifications to let people know when interesting things happen, such as:
- A message has arrived
- An event is about to occur
- New data is available for download
- The status of something has changed
In iOS 8 and later, apps can define actions that users can take within a notification. For example, a notification from a to-do app might let users mark an item as done without having to open the app.
iOS defines two types of notifications
A local notification is scheduled by an app and delivered by iOS on the same device, regardless of whether the app is currently running in the foreground. For example, a calendar or to-do app can schedule a local notification to alert people of an upcoming meeting or due date.
A remote notification (also called a push notification) is sent by an app’s remote server to the Apple Push Notification service, which pushes the notification to all devices that have the app installed. For example, a game that users can play against remote opponents can update all players with the latest move.
If you receive local or remote notifications while your app is running in the foreground, you’re responsible for passing the information to your users in an app-specific way.
To ensure that users can customize their notification experience, you should support as many as possible of the following notification types:
A banner is a small translucent view that appears onscreen and then disappears after a few seconds. Users can also see a version of the banner on the lock screen and in the Notifications view of Notification Center. In the banner, iOS displays your notification message and the small version of your app icon (to learn more about the small app icon. Users tap the banner to dismiss it and switch to the app that sent the notification.
In addition to a default action that users can take by tapping a banner, you can also define two actions that are revealed when users swipe the banner. Tapping a notification action button dismisses the banner and launches your app (possibly in the background) to handle the action.
A notification alert is a standard alert view that appears onscreen and requires user interaction to dismiss. You supply the notification message and either a default action or up to four specific actions that are revealed when users tap the Options button. You have no control over the background appearance of the alert.
When users tap a default or custom action button in an alert, iOS simultaneously dismisses the alert and launches your app (possibly in the background). Tapping the Close or OK button dismisses the alert without opening your app.
A badge is a small red oval that displays the number of pending notification items (a badge appears over the upper-right corner of an app’s icon). You have no control over the size or color of the badge.