Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Custom iOS push notification sound

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

like image 973
nithinreddy Avatar asked Apr 11 '12 14:04

nithinreddy


People also ask

How do I change the push notification sound on my Iphone?

To set a custom notification sound go to 'Settings,' scroll down, and then tap on 'Sound & Haptics. ' Under 'Sounds and Vibration Patterns,' select the type of notification that needs to be changed. From the menu, choose the sound that needs to be set as the notification sound.

How do I change my push notification Sounds?

Choose the appropriate category and select Alert. On the Notification category page, scroll down to the Sound section. It shows the default tone enabled for the app. Tap Sound and select your desired notification tone from the list to change the presets.

Can you personalize push notifications?

To add an extra layer of personalization to an iOS or Android push campaign message, you can use geo-location based push notifications. There are two ways brands can send push notifications based on a user's location: Location-based notifications: App users receive these pushes based on data collected on the backend.


1 Answers

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.

like image 104
Inn0vative1 Avatar answered Oct 26 '22 18:10

Inn0vative1