Search code examples
iosiphoneipadapple-push-notifications

IOS Push Notification - how to specify sound for notification


I’m trying set a sound for my notification but its not working in the device please tell me how to set the alert sound for the notification.

$payload = '{
    "aps" :
    {
        "alert" :"'.$message.'",
        "badge" : 1,
        "sound" : "default"
    }  
}';

i have used the above code the set a sound for the push notification its not working pls tell where I'm wrong.


Solution

  • The code you have written is fine, one thing you can do is do not send the sound key val pair if you want to play the default send, as per apple docs if there is no data for sound it will play the default sound.

    possible duplicate