Configure sounds for push notifications
Add sounds and tones to push notifications to indicate to users if a message is urgent or just requires the users' attention.
Example JSON for adding sound to push notifications
The following JSON is an example of how to add a tone to your push notification. The name of the tone used in the example is NotificationAlert-2".
json["aps"]["sound"] = "NotificationAlert-2.caf";The table at the end of this topic list all the available tones. To listen to the tone of each sound, you must configure a notification with the target sound parameter.
Note:
For each tone, you have the option to shorten the length of the ring by adding the suffix
-Short. You can shorten all tones except NotificationAlert-5.caf.Example JSON for critical alerts including sound
The following JSON is an example of how the sound parameter is defined for critical alerts. For more information about critical alerts, see Mobile critical alerts.
json["aps"]["sound"] = {
"critical": 1,
"name": "NotificationAlert-3-Short.caf",
"volume": 1.0
};
The parameters in the sample JSON code are as follows:
- The critical parameter defines the notification as a critical alert.
1means that the critical alert is active,0means that the critical alert is inactive. - The volume parameter defines the volume of the notification sound. The range is from
0.1as the quietest to1.0as the loudest. - The name parameter is the name of the tone that is activated when a push notification is sent. For critical alerts, considering user rhythms with a dramatic tone. Note:If a name value isn’t defined, the system uses the application’s default ringtone. If an application doesn't have a defined ringtone, then the system uses the device's default ringtone.
To listen to the tone of each sound, you must configure a notification with the target sound parameter.
Accepted values are listed in the table.Note:For each tone, you have the option to shorten the length of the ring by adding the suffix-Short. You can shorten all tones exceptNotificationAlert-5.caf.Accepted file name values Tone rhythm NotificationAlert-1.cafMellow, Relaxing, Slow NotificationAlert-1-Short.cafMellow, Relaxing, Slow NotificationAlert-2.cafDramatic NotificationAlert-2-Short.cafDramatic NotificationAlert-3.cafDramatic NotificationAlert-3-Short.cafDramatic NotificationAlert-4.cafMellow, Relaxing, Slow NotificationAlert-4-Short.cafMellow, Relaxing, Slow NotificationAlert-5.cafMellow, Relaxing, Slow NotificationAlert-6.cafFestive, Happy NotificationAlert-6-Short.cafFestive, Happy NotificationAlert-7.cafFestive, Happy NotificationAlert-7-Short.cafFestive, Happy NotificationAlert-8.cafFestive, Happy NotificationAlert-8-Short.cafFestive, Happy NotificationAlert-9.cafDramatic, Powerful NotificationAlert-9-Short.cafDramatic, Powerful NotificationAlert-10.cafDramatic, Suspenseful NotificationAlert-10-Short.cafDramatic, Suspenseful NotificationAlert-11.cafDramatic NotificationAlert-11-Short.cafDramatic NotificationAlert-12.cafDramatic NotificationAlert-12-Short.cafDramatic NotificationAlert-13.cafDramatic NotificationAlert-13-Short.cafDramatic NotificationAlert-14.cafDramatic NotificationAlert-14-Short.cafDramatic
Note:
If a name value isn’t defined, the system uses the application’s default ringtone. If an application doesn't have a defined ringtone, then the system uses the device's default ringtone.