0

I have to set custom sound when I receive APN in my iOS app.
For custom sound I mean a sound that every user can change within his app and not different from the default sound.
I already know that I can set the attribute "sound" on the payload of my notifications, but what I would like to understand if there is a way to play a different sound based on the user's settings (user A can set sound1.aiff, user B can set sound2.aiff).

The only way that I can see is that the notification is already sent with the name of the file to play that the user has set on preferences: this means that I have to store settings on server-side. Now I do not this.
Do you confirm me that's the only way?

jscs
  • 63,095
  • 13
  • 148
  • 192
enfix
  • 6,188
  • 11
  • 51
  • 75

1 Answers1

2

Not an ideal solution, but this might work for you...

Send a silent notification instead. When your app receives the silent notification, check the user’s settings and post a local notification with the desired sound.

Jake
  • 11,465
  • 8
  • 40
  • 70
  • That's can be a better solution. How can I do this ? How can I send "silent" solution ? – enfix Feb 12 '18 at 08:21
  • 1
    Add `content-available: 1` to your APN, along with one or two other changes in your app: https://stackoverflow.com/questions/36694963/what-is-silent-push-notification-when-does-the-device-receive-it – Jake Feb 12 '18 at 08:28