Push Notifications - sound via ionic push api?


Does anyone have a working example of, or know how to create a vibration/sound using: https://push.ionic.io/api/v1/push ? I can get notifications to come through but they are not playing a sound or vibrating the device. I’m looking at iOS only for now.

Where do you place the sound file? WWW root? Project root? Do you need a sound file for a default sound?

I don’t feel like the docs are very clear on this and I’m confused as to whether you NEED the phonegap-plugin-push or not? Though it throws an error if you exclude it (even though the docs say it is optional).

In short, what do I need to send to https://push.ionic.io/api/v1/push to enable the device to play a sound? Sending the following to https://push.ionic.io/api/v1/push doesn’t work.

    "14"   //registered Ionic User id with associated token for iOS
    "alert":"Hello World!",
      "sound":"beep.aiff", //stored in project root and www folder
      "expiry": 1454947886239,
      "priority": 10,
      "contentAvailable": 1,

APP setup:

var push = new Ionic.Push({
                        "debug": true,
                        "onNotification": function(notification) {
                            var payload = notification.payload;
                            console.log(notification, payload);
                            console.log("this is the on notification callback being invoked");
                        "onRegister": function(data) {
                        "pluginConfig": {
                            "ios": {
                                "badge": true,
                                "sound": true, 

What’s the deal? Where am I dropping the ball? Does var push need to be in global scope?? I’m creating this inside of a controller on app load?


after your init you should run push.register(),…that will return your new token. This token you should later use to send your push messages.

console.log('my token is: ', token.token);


I am, absolutely, sorry I didn’t include that. I have an active registered user on the ionic dashboard complete with token.


I’m having the exact same problem, actually. Would love a solution to this :blush:

For reference, here’s my description of the same problem: Ionic Push payload options (e.g. sound, badge) not working [solved]



I finally got help on the gitter.im support channel.

Turns out my curl request was poorly formatted with badge and sound specified inside the payload. Turns out that they need to go as a child of “ios” rather than inside the payload. Here’s the ill-formatted request that I used previously:

curl -u my-private-key: -H “Content-Type: application/json” -H “X-Ionic-Application-Id: my-app-id” https://push.ionic.io/api/v1/push -d ‘{“tokens”: [“my”,“device”,“tokens”],“production”: false, “notification”:{ “alert”:“I’m a push”, “title”: “Hello world”, “android”: {“payload”: {“badge”: 4,“sound”: “default”}}, “ios”: {“payload”: {“badge”: 4,“sound”: “default”}}}}’

And here is the correctly formatted curl request that results in badge and sound working properly:

curl -u abfc6bf427fe53c4419685ec824cd34c59e2dba7734e1158: -H "Co https://push.ionic.io/api/v1/push -d ‘{“tokens”:[“d59764af2f9c36bd4d6252c0f80a1553a4d18ce51fefd83bbf32fb8468d38de8”],“notification”:{“alert”:“Hello World oh man!”,“ios”:{“badge”:1,“sound”:“default”}}}’

So, there we go…ha.