Custom iOS push notification sound

37,063

Solution 1

According to the push notification guide:

You can package the audio data in an aiff, wav, or caf file. Then, in Xcode, add the sound file to your project as a nonlocalized resource of the application bundle.

It doesn't say anything about MP3s. I've used aif files which worked. I'd stick to what Apple specifies.

Solution 2

You can't play .mp3-files. However, you can convert them into .wav files here: http://media.io/ (online & free). Then put the converted file in your XCode project and you can call it by specifying "sound":"sound.wav"

Share:
37,063
nithinreddy
Author by

nithinreddy

iOS and Android developer

Updated on July 09, 2022

Comments

  • nithinreddy
    nithinreddy almost 2 years

    I have been facing an issue. I implemented push notification in iOS with custom sound. Its a MP3 file. It plays well when I receive a push notification in iOS 5, but in iOS4, it doesn't play any sound. Can you help me with this?

    The code is like this

    {
        "aps": {
            "badge": 10,
            "alert": "Hello",
            "sound": "sound.mp3"
        }
    }
    

    Nithin