Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

APNS notification sound for iOS

I am having some trouble setting the message sound for my app.

So in the apns response sent by the server, I specify "sound" : "default", and its all good. But if I set the "sound":"chime", or "sound":"note", they dont seem to work. It always plays Default. Those are sounds i see form iPhone -> settings -> Sounds.

How can i use the "Note" as my preferred notification sound, or should i create my own sound, and add it to the bundle?

like image 833
Legolas Avatar asked Aug 25 '14 02:08

Legolas


People also ask

How do I put custom notification Sounds 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.

Can push notifications have sound?

Tap Notifications. Tap Sounds. Tap either Alarm Events, Silent Alarm Events, or Non-Alarm Events.

Does iOS support push notification?

Apple announced support for web push notifications for Safari on iOS starting in 2023. At the company's annual developer event WWDC in June 2022, Apple announced that this feature was coming to iOS.


1 Answers

If you want to play a sound other than the default one, you will need to package the sound in your bundle and specify the file name of the sound in the payload. For example, if I were to include a sound file called notificationCupcake.caf in my app, I would include this JSON key/value pair in the push:

 "sound": "notificationCupcake.caf"
like image 175
Wayne Hartman Avatar answered Sep 20 '22 04:09

Wayne Hartman