To send Time-Sensitive notifications, which are designed for alerts requiring immediate attention on iOS 15 and later, follow these steps:
Enable Capability in Xcode:
- In your Xcode project settings, navigate to the "Signing & Capabilities" tab.
- Click the "+" button to add a new capability.
- Select "Time Sensitive Notifications" from the list.
Understanding Time-Sensitive Notifications:
- These notifications are available on iOS 15 and later.
- They are designed for alerts that require immediate attention, such as security alerts or important updates.
- They can bypass active Focus modes and Do Not Disturb settings if the user has granted your app permission to do so.
- They are visually distinguished by a yellow "Time-Sensitive" banner.
- Users retain control and can disable Time-Sensitive notifications for your app in their device's Settings.
Using the
ios_interruption_levelParameter: When sending a push notification, you can use theios_interruption_levelparameter to specify the desired behavior for iOS 15+:active(Default): The notification is delivered normally and may be suppressed by Focus modes.passive: The notification is added to the notification list without lighting up the screen or playing a sound. It can be suppressed by Focus modes.time-sensitive: The notification is delivered immediately and aims to bypass Focus modes and scheduled delivery. This requires the user to have granted your app permission for Time-Sensitive notifications.critical: For highly urgent alerts (e.g., severe weather warnings). These notifications bypass Do Not Disturb and the ringer switch, and can play a sound even if the device is muted. Important: Usingcriticalrequires a special entitlement approved by Apple. Without this entitlement, notifications sent with this level may not be delivered or will default toactivebehavior.
Note: Always ensure your app requests the necessary permissions from the user to deliver notifications, including Time-Sensitive ones. The effectiveness of these levels is contingent on user permissions.
Comments
0 comments
Please sign in to leave a comment.