Testing notifications using the Apple Push Notification Console
Push notification is a very important feature that every iOS application has nowadays.
During the testing phase of an iOS application, developers often rely on third-party apps or services to send push notifications for testing and debugging purposes. However, with the introduction of the Apple Push Notification Console, there is no longer a need for these third-party apps.
Watch “Meet Push Notifications Console” from WWDC23
The Apple Push Notification Console is a powerful tool provided by Apple that allows developers to send push notifications directly from their development environment. It eliminates the need to integrate external services or rely on additional applications, streamlining the testing process.
The Push Notification Console is a web interface we can use to send/test notifications and monitor their delivery status in the development environment.
Step 1: Sign to your Apple Developer Account
Step 2: It takes you to CloudKit Console
Choose the Push Notifications — To Test Push Notification Integration with your app.
Step 3: Push Notifications Portal
Note: By default select some random application bundle identifier from our Apple developer account.
Search for the bundle identifier for which you want to test the push notification.
Step 4: Push Notifications Portal
NOTE: In case, the Push Notification capability is not enabled for the selected bundle it will ask to enable it.
Select the bundle identifier that has a push notification capability enabled.
Step 5: Create and Send Notification
Let’s know all the form input parameters,
Title: Help us to identify the notification in the console
Environment: Development or Production
Device Token: Identifier of the recipient’s device
apns-push-type: The apns-push-type only allows one of the valid values i.e., alert
, background
, complication
, fileprovider
, location
, pushtotalk
, voip
, liveactivity.
NOTE: Use the
alert
push type for notifications that trigger a user interaction — for example, an alert, badge, or sound.
apns-expiration: We can set APNS expiration as Attempt delivery once
or with specify expiration date.
Attempt delivery once
attempt to deliver the notification only once and not store it.
apns-priority:
- Low(1)
: Prioritize the device’s power considerations over all other factors for delivery, and prevent awakening the device
- Medium(5)
: The notification will be delivered based on power considerations on the user’s device.
- High(10)
: The notification will be delivered immediately.
Payload:
Payload is the JSON which has a predefined set of keys that can have the respective values.
The default is title, subtitle, and body.
Just Send :)
We have many other parameters to use…
Notification Delivery Logs
The console contains the Delivery Log, where you can gain insight into your notification history about the notification sent, who sent it, and when it’s delivered to the target device.
Conclusion
The Testing Notifications feature in the Apple Push Notification Console empowers iOS developers by offering a streamlined and efficient method to test push notifications during the development and debugging phase. By eliminating the reliance on third-party apps and services, developers can focus on enhancing the push notification experience within their app, leading to a more polished and reliable end product.
Testing notifications feature in the Apple Push Notification Console, developers can simulate the behaviour of push notifications without the need for a production environment or involving actual users. This enables them to thoroughly test the functionality, appearance, and behaviour of push notifications within their app.