SachinVsSachin
SachinVsSachin

Reputation: 6427

Disable push notification sound whenever I want

Is there a way to disable the push notification sound - whenever the alert comes in.

Currently I am using a blank sound file to do this, but is there a way to disable the sound.

Upvotes: 0

Views: 3343

Answers (3)

Saad
Saad

Reputation: 8947

Go to the preferences application and select "Notifications", select your app and turn off the sound.

Upvotes: -1

Christopher Pickslay
Christopher Pickslay

Reputation: 17772

You specify a bitmask of notification types when you register for notifications. If you don't want a sound to be played when notifications come in, remove UIRemoteNotificationTypeSound from that bitmask:

[[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationTypeAlert|UIRemoteNotificationTypeBadge)];

Upvotes: 1

Varun Bhatia
Varun Bhatia

Reputation: 4396

If you dont want to play sounds, you can register for remote notifications again for only alert notification type. If you want the sound should not be played on receiving the alert notification, you should not be sending the sound value in the notification payload sent from the notification server.

Upvotes: 2

Related Questions