@OJCode14 wrote:
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.
{ "user_ids":[ "14" //registered Ionic User id with associated token for iOS ], "notification":{ "alert":"Hello World!", "ios":{ "badge":1, "sound":"beep.aiff", //stored in project root and www folder "expiry": 1454947886239, "priority": 10, "contentAvailable": 1, "payload":{ "badge":1, "sound":"beep.aiff" } } } }
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) { console.log(data.token); }, "pluginConfig": { "ios": { "badge": true, "sound": true, "alert":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?
Posts: 3
Participants: 2