Yakir Sayada
Yakir Sayada

Reputation: 181

Play the default notification sound on user settings

I need to play the default push notification sound in my app, this is possible ? from my understanding i can play specific sound if i have the sound ID. can i play the chosen "default" sound in my app ?

Upvotes: 0

Views: 425

Answers (1)

Rajan Maheshwari
Rajan Maheshwari

Reputation: 14571

You can play any sound that you want. By default we play the default notification sound only.

The payload should be like this

{
  "aps": {
    "alert": "Alert Message",
    "badge": 1,
    "sound": "default"
  }
}

Just pass "default" in sound key.

If you want to play a custom push notification sound, pass the sound name with extension for example "mynotifsound.caf"in sound key and make sure the file with mynotifsound.caf should be present in app's bundle.

{
  "aps": {
    "alert": "Alert Message",
    "badge": 1,
    "sound": "mynotifsound.caf"
  }
}

Upvotes: 2

Related Questions