For mobile apps only. Custom sounds are not supported on web push.
Setup
Create sound files
Be sure to create sound files according to the following rules. If the device cannot find the file in question, or if the file is not in a supported format, it will fall back to the default system notification sound.Keep sound filenames lowercase since some platforms ignore upper case letters for sound files. Instead of
AwesomeSound.wav
use awesomesound.wav
or awesome_sound.wav
.Platform | Extensions | Notes |
---|---|---|
iOS | .wav .aiff .caf | Sounds must be encoded as Linear PCM, MA4 (IMA/ADPCM), µLaw, or aLaw. Must be less than 30 seconds. |
Android | .wav .mp3 .ogg | Recommended length less than 30 seconds. Keep file size small, large files may not play on some devices. |
Huawei | .wav .mp3 .wma | Recommended length less than 30 seconds. Keep file size small, large files may not play on some devices. |
Amazon | .wav .mp3 .ogg | Recommended length less than 30 seconds. Keep file size small, large files may not play on some devices. |
Add sound files to app
To adds sounds to notifications, you must include the sound files as resources within your app. External URLs are not supported.Add sound files to the appropriate location in your Xcode project depending on your SDK.
SDK | Folder |
---|---|
iOS Native | Add files to the Xcode project root. Make sure Add to targets is selected when adding files so that they are automatically add to the bundle resources. |
Cordova, Ionic | Add files to Resources directory within the Xcode project in <project-root>/platforms/ios/project-name.xcodeproj . |
Unity | Add sounds anywhere in your Unity project, build your project, and then move those sounds to the Xcode project root. |
Send notifications
Add the file extension when referencing the sound resource. For instance, 
explode_sound.wav
. Set in the dashboard when sending push messages or use the Create Notification API ios_sound
property.For no sound, pass in nil
to the Sound field.
If you’ve very recently added a sound resource to your app, you may want to wait a few days before sending notifications using the sound. This is because it can take many days or even weeks for the majority of your users to update their apps to the latest version which contain your new sound resource.If a user has an older version of your app without the sound resource and receives a notification that references it, they will hear only the default system notification sound.
FAQ
Can I set a default sound?
Use a Template that references the sound and/or Android Notification Channel.Why is my notification not playing the custom sound file?
There are a few reasons why a sound may not play.- Sound file has an incorrect file extension
- Sound file is not encoded in a supported format
- Sound file is in the incorrect location
- Sound file is too long
res/raw/
.
If shrinking resources is enabled, you can protect sound files from being removed by creating keep.xml in res/raw/ with following code
xml