Oracle Help Center | Oracle Push Cloud Service (Standalone) title

Sounds & Badges

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:

  1. Via Web Dashboard
  2. Via API

Method 1: Web Dashboard:

We've built Sounds and Badge configurations directly into our Push Composer tab on the Web Dashboard:

"PushIO Web Dashboard, Push Composer, Advanced Options"

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.

Method 2: API

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.

curl "https://api.pushio.com/api/v1/notify_app/[APP_ID]/[SENDER_SECRET]" -d 'payload={"message":"Test ABC 123","payload_apns":{"badge":"5","sound":"default.wav"}}&audience=broadcast'

For more information on sending via API, see the Server API topic..

Clearing Badges

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:

- (void)applicationDidBecomeActive:(UIApplication *)application {
    application.applicationIconBadgeNumber = 0;
}

In addition, sending a notification with a badge of 0 will also clear badges from the application on the home screen as well.