The Push IO Manager handles sound and badge requests for you. No extra work is needed to play a sound or display a badge from a push notification. However, some code is needed if you wish to clear that badge number on app open (see bottom of this document).
Push Notifications with Sounds and Badges can be sent two ways:
We've built Sounds and Badge configurations directly into our Push Composer tab on the Web Dashboard:
Note: The sound file must be included in your project and you must include the filetype (.wav, .caf, etc.) in the Advanced Options screen. Furthermore, the badge number must be an integer.
If you're sending via API, you can include badge and sound specifications in the APNs Payload. This example cURL will send the message "Test ABC 123" with the
Default.wav sound and a badge of 5.
For more information on sending via API, see the Server API topic..
It is simple to clear badges. Each time the application becomes active, reset the badge to zero. To do so, add this code to the
applicationDidBecomeActive method of in your
AppDelegate.m file in Xcode:
In addition, sending a notification with a badge of 0 will also clear badges from the application on the home screen as well.