0

I am using a UNNotificationService extension to update the Payload content of a received Push Notification. I'm able to change the displayed alert text and the updated text is correctly displayed. However changing

"sound":"default" => "sound":"something.caf"

does not play the modified sound. The default alert sound is played.

The audio file "something.caf" is packaged with the App and plays correctly when the Payload received from the backend server contains "sound": "something.caf".

Any suggestion to what I should be looking at? (missing configuration etc)

Thanks

Saoirse
  • 51
  • 5

2 Answers2

0

Is the sound file added to your Notification Service ?

You can verify this on inspector tab -> Target Membership section

Mosbah
  • 1,347
  • 1
  • 14
  • 28
  • Thanks for the reply. The Notification Service was not the target for the audio file. I've made the change to include the App as well as the Notification Service as the target for the file. However, the issue still persists. – Saoirse Jan 17 '19 at 10:57
  • Did you try uninstalling and reinstalling the app ? – Mosbah Jan 17 '19 at 11:00
  • I was able to fix the issue by setting the UNMutableNotificationContent.sound property to the required sound. – Saoirse Jan 18 '19 at 11:34
  • cool, happy to hear that, think of adding this to your answer. – Mosbah Jan 18 '19 at 13:24
0

Setting the "UNMutableNotificationContent.sound" property to the required sound file fixes the issues and plays the required file.

Saoirse
  • 51
  • 5