Your web browser is out of date. Update your browser for more security, speed and the best experience on this site.

Update your browser
CapTech Home Page

Blog June 11, 2018

Clean Up Your Lock Screen: 3 Updates to User Notification Management in iOS 12

iOS 12 provides many enhancements to user notifications, but we're drilling into what users care most about: a streamlined

lock screen that contains only the content that they want to see.

We all know that push notifications help drive user engagement, but there is plenty of data out there that also indicates that too many notifications (the crowded lock screen) ultimately drives app un-installs. 🙀

So in addition to evaluating the value added to the user by your notification content, here are 3 new management features with iOS 12 that will help keep your users feeling satisfied and engaged with their lock screen.

1. Provisional Authorization & Critical Notifications

Provisional Authorization

UNAuthorizationOptions.provisional

Provisional Authorization is an optional trial period where users receive a taste of your app's push notifications before deciding whether they want to permanently receive them. This is an opt-in setting that you provide along with other UNAuthorizationOptions ( .badge, .sound, or .alert) when requesting notification authorization.

What You Need to Know

  • If .provisional is specified, push notifications are automatically enabled and the user will not be prompted on initial app launch to accept push notifications
  • By default, notifications sent under provisional authorization are quiet notifications, in that they only appear on the Notification Center and lock screen, are not pushed as alerts, and do not play sound
  • Users may opt-in to prominent notifications by tapping on the notification to see a prompt to accept or deny regular notifications
  • The length of the trial period for notifications is determined by the system
  • At the end of the trial period, users will be prompted to accept regular notifications on app launch if they haven't already accepted them through a quiet notification

Considerations

  • Importance of your notifications: Notifications sent under provisional authorization will present quietly until the user opts in or the trial period ends, so if you have notifications that you feel need to draw closer attention, you may consider requesting the user opt in immediately
  • The type of notifications that you are sending through provisional: If you only send badge or sound notifications, this does not apply

Why Should I Use Provisional Authorization?

It can drive further engagement with the content in your app and will increase the total number of users that stay enrolled in notifications in the long term.

It's "try before you buy". Implementing this trial period for notifications aims to eliminate the subset of users that automatically deny notifications on app launch, not knowing how notifications will affect their user experience.

Critical Alerts

UNAuthorizationOptions.criticalAlert

Critical Alerts deliver high priority information to users, regardless of users' notification settings. These alerts are designed to be disruptive, and will bypass "Do not Disturb Mode" and silenced phone ringers. They present an alert, play sound, and vibrate.

Wait! Does this mean my dating app notifications will blare out while I'm at church? No, you won't have to worry about that.

Apple must grant special privileges to apps which contain high priority information in order to send notifications of this type.

Types of information that warrant critical alerts:

  • Medical and Health
  • Home and Security
  • Public Safety

How Do I Enroll My App for Critical Alerts?

You must apply for entitlement. In the entitlement application, you must provide justification for sending critical alerts by answering several questions:

Note: As a developer, you do not need to enroll for testing or personal use. And Apple will remind you of this when you go to enroll.

How Do I Use Critical Alerts and Provisional Authorization in My App?

Both of these features can be set using new UNAuthorizationOptions values available on the NotificationCenter request authorization API method:

func requestAuthorization(options: UNAuthorizationOptions = [],
 completionHandler: @escaping (Bool, Error?) -> Void)

These values are set along side your existing UNAuthorizationOptions:

UNUserNotificationCenter.current().requestAuthorization(
 options:[.badge, .alert, .provisional, .criticalAlert]) { (success, error) -> () in
 //authorization complete
 }

For critical alerts only, add a critical alert sound on your UNNotificationContent object or aps payload:

let content = UNMutableNotificationContent()
content.sound = .defaultCritical

This is what defines your notification as a critical alert.

2. Grouped Notifications

iOS 12 introduces the ability to create custom grouped notifications to streamline content and help users managed multiple, related notifications at once.

If your app sends many notifications, this is an easy way to streamline and enhance your users' interaction with your app by ensuring that important information doesn't get lost, and that users are not overwhelmed by your app's notifications, causing them to disable notifications altogether.

Notifications can be assigned to custom groups by simply assigning a unique identifier to the threadIdentifier property on UNotificationContent for local notifications, sent via aps payload for remote.

Implementation Highlights and Observations

  • This API was introduced in iOS 10 with rich notifications and private notifications, so if you've adopted this already your notifications will be grouped in iOS 12.
  • The default behavior, if you do not provide a threadIdentifier, is to group notifications by app group.
  • The provided threadIdentifier must be unique relative to other threadIdentifier sent by your app.
  • Notifications are ordered by time-stamp. The most recent notification appears as the leading notification on a group.
  • The system handles grouping notifications that are sent with the same name, and ensures that they are handled as separate notifications within your group. The system also handles coalescing notifications with different names that are to be presented in the same notification group.
  • When you have notifications set up to be grouped, but notifications are prominent, notifications will show up on the Notification Center and lock screen ungrouped for the first minute before grouping. Quiet notifications immediately group.

Limitations

  • If you send the user multiple groups of notifications within your application, and a user opts out of notifications from the management feature on a single notification group, ALL notifications will be disabled for your app.
  • The user cannot opt into quiet notifications for some groups and prominent notifications for other groups. This is still managed at the app level within Settings.

What to Consider When Defining Notification Groups

  • Importance of Notification Content
    • This may mean that higher priority notifications get their own thread-id so that they appear individually, whereas lower priority updates get grouped together
  • Frequency and lifecycle of information
    • You may want to group information that is quick or ephemeral (such as texts or instant messages) more aggressively than information that is long-lived or accumulates more slowly
  • User preferences regarding priority and organization of information
    • If your app allows users to organize the way they consume data in your app, consider grouping your notifications in a way that matches their preferences

Grouped Summary Strings

Grouped summaries give users quick insight into the types of notifications that are bundled in a group.

Two groups of notifications using a custom summary string

One group of notifications using a custom summary string. Note that the system handles coalescing the notification names

and supplies the final string to the provided argument parameter.

It's as simple as providing a categorySummaryFormat parameter on your UNUserNotificationCategory initializer:

convenience init(identifier: String,
 actions: [UNNotificationAction],
 intentIdentifiers: [String],
 hiddenPreviewsBodyPlaceholder: String?,
 categorySummaryFormat: String?,
 options: UNNotificationCategoryOptions = [])

There are two supported formats for grouped summaries:

  • Integer representing the notification argument count, and String represent the summary argument name: "%u Additional Notifications From %@"
  • Only an integer representing the notification argument count: "%u Additional Notifications."

Parameters are fetched from summary-argument and summary-argument-count in your UNNotificationContent object or push payload:

let content = UNMutableNotificationContent()
content.title = "Fluffy"
content.body = "Incoming Notification. This is important"
content.threadIdentifier = "messages-from-cats"
content.summaryArgument = "Fluffy"
{
 "aps": {
 "alert": {
 "title": "Fluffy",
 "body": "Incoming Notification. This is important.",
 "summary-arg": "Fluffy",
 "summary-arg-count": 3
 },
 "thread-id": "important-cat-messages"
 }
}

Note: Providing summary-arg-count in your notification is optional. This is used to indicate if there are multiple actions associated with one notification. If this argument is not included, the assumed count is 1.

Grouped Previews

This is a feature that was introduced with iOS 11, but WWDC18 gave us a friendly reminder that providing a hiddenPreviewsBodyPlaceholder in your UNUserNotificationCategory is a good compliment to your detailed summary previews.

If you haven't used this property, it is similar to the new summary preview, but operates under a different context.

This string will be used if the user sets their notifications to private, and will replace the notification, or leading notification, with this preview text instead. Once the user unlocks their device, a summary preview will be displayed.

Localizing Grouped Previews and Summaries

If you are using preview or summary strings for your grouped notifications, it's very important that you localize your strings, and because notifications must be able to respond dynamically to system changes in localization, to also use the localization function for notifications that was introduced in iOS 10:

class func localizedUserNotificationString(forKey key: String,
 arguments: [Any]?) -> String

The benefit of using this method over the generic NSLocalizedString method is that the system won't load the localized string until the notification is delivered, ensuring that the notification will be sent in the correct language regardless of when the user changes their language settings.

Pluralizing

It's also important to remember to pluralize your strings by using a Stringsdict file to store variations of your string to be returned when one or more quantity of notification values is provided.

3. Custom Notification Settings

UNAuthorizationOptions.providesAppNoficationSettings

This new authorization option provides support for deep linking users to your custom notification settings page from three places:

  1. The Lock Screen
  2. Notification Center
  3. Settings app

A major benefit to this feature is that it provides users direct access to notification configuration screens within your app, which leaves users less likely to turn off notifications when presented with both options.

How Do I Add a Custom Settings Page?

The system will deep link into your custom settings pages from each of these places, after adding the following code:

STEP 1: In application:didFinishLaunchWithOptions, register for remote notifications and request authorization from the user, including the new authorization option .providesAppNotificationSettings.

UNUserNotificationCenter.current().requestAuthorization(
 options:[.badge, .alert, .providesAppNotificationSettings]) { (success, error) -> () in
 //authorization complete
 }
application.registerForRemoteNotifications()

Step 2: Deep link to a custom settings screen by implementing this delegate method:

func userNotificationCenter(_ center: UNUserNotificationCenter, openSettingsFor notification: UNNotification?) {
 /*
 Note: the value of notification will be nil, if the deep link from the Settings app was tapped.
 Otherwise, it will contain a value.
 */

 // route user to the view controller which contains your settings
 let settingsViewController = UIViewController()
 self.window?.rootViewController = settingsViewController
 }
}

This results in the system providing the following options:

WWDC 2018 iOS Notifications

From the management screen, users have the option to:

  • Turn Off Notifications (selection of this action prompts for confirmation)
  • Deliver Quietly or Deliver Prominently
  • Quick Link to Settings

Considerations

  • As stated above, the option to deliver notifications quietly or prominently is at the app level. This cannot (yet) be configured within single notification groups.
  • If you have an existing custom notifications settings screens in your app, you can provide it for deep linking in the new delegate method (described above.) Consider ease of access to the screen if it's not at the root of a flow within your app.

Final Thoughts...

Apple has given us several new notification management features this year with iOS 12, along with two overarching messages that compliment them:

  • This is the year to refine your apps from all angles--performance, design, and user experience.
  • Apps are increasing their presence across the system and with so many apps out there, you not only need to leave the main app to stay relevant, you need to carefully manage your users' experience outside your app.