Custom Alert Sounds

Custom sounds can be a great way to make your application stand out. When you don't customize sounds, your app uses the system setting for receiving an SMS. In some cases, this may cause the user to either disable sound, disable push or uninstall your application. Having a unique and entertaining sound appropriate for your context is a great way to keep users engaged. This article will help you implement custom sounds on iOS and Android with Sailthru Mobile.

iOS

Default sound

For a default sound, use the key default in the Sailthru Mobile dashboard or via the API as the sound key.

Vibration

Whether the sound plays or a vibration occurs is a device level setting controlled by the user. This is set in the user's settings. You cannot specify that a vibration should occur with a special push payload. If you want a vibrate you occur every time, the suggested technique is to programmatically vibrate the phone when a push arrives, but this is still subject to user settings.

Custom Sounds

For iOS, you need to include the right type of file in your app bundle, which Preparing Custom Alert Sounds covers in detail. If the audio file doesn't exist or default is specified as the value, the default alert sound is played. The audio must be in one of the audio data formats that are compatible with system sounds.

Android

Like on iOS, Android uses a packaged sound for custom sounds. You should simply put the audio file under res/raw folder of your project. If the sound can't be found, the default will be played. Note: See Supported Media Formats on the Android docs for details on what audio file formats are supported on Android devices.

Publishing

When it comes time to publish your message, simply enter the file name in the message compose screen. For example, if you're sending a photo of a cat in an image type message, you might want to send a custom sound that sounds like a cat purring. Note: On Android, the filename entered in the sound field must not contain the file extension.

Optimizing for Both Platforms

A common file type between both Android and iOS is a linear PCM Wave file with a .wav extension. You can then generate the audio file once from your audio software and use for both applications.

Contact us

Top