0

I have settings in my app, in that I have a toggle button for turning On and Off the sound and vibration as well, while receiving remote notification. Below is my code for registering remote notification in AppDelegate

let notificationTypes: UIUserNotificationType = [UIUserNotificationType.Alert, UIUserNotificationType.Sound]
    let pushNotificationSettings = UIUserNotificationSettings(forTypes: notificationTypes, categories: nil)
    application.registerUserNotificationSettings(pushNotificationSettings)
    application.registerForRemoteNotifications()

For sound I referred this Remove sound from notification but it does'nt seems to work.

Whatsapp having this feature, so surely it will be possibly

Can anyone please advise in this?

Community
  • 1
  • 1
Austin Michael
  • 460
  • 4
  • 18

1 Answers1

4

please remove sound key-value from JSON payload.

I have just checked it. It works for me.

{"aps":{"alert":"Enter your message","badge":1}}
Balaji Galave
  • 1,066
  • 6
  • 9