I'm trying to use Safari Push Notifications with Windows Azure as backend. I was able to upload Website Push ID: web.com...
certificate to Azure Mobile Services
and it was accepted without any error message in the apple push notification settings
.
To handle the Web Service Endpoints (webServiceURL/version/pushPackages/websitePushID
, webServiceURL/version/devices/deviceToken/registrations/websitePushID
, and so on) I created in the Mobile Services a API which is all working fine.
But I'm unable to send a push notification or get an error message.
My test code looks like this:
function send(req, res) {
var push = req.service.push;
var devicesTable = req.service.tables.getTable('devices');
devicesTable.read({
success: function(devices) {
devices.forEach(function(device) {
console.log("send to deviceToken " + device.deviceToken);
push.apns.send(device.deviceToken, {
alert: 'Toast: A new Mobile Services task.',
payload: {
inAppMessage: "Hey, a new item arrived: '"
}
});
push.apns.send(device.deviceToken, {
alert: {
"title": "Test 123 ",
"body": "Test 123 ",
"action": "View"
},
"url-args": ["boarding"]
},
{
error : function(err) {
console.log("send error " + err);
}
}
);
});
}
});
res.send(200, "");
}
Is my problem the formatting of the dictionary or does Azure Mobile Services for some reason not support Safari Push Notification?
As far as I know the APNS is the same for iOS, Mac and Safari push notifications.
Update: I tested it with SimplePush so the certificate is fine as is the registration of Safari. My payload looks like this:
// Create the payload body
$body['aps'] = array(
'alert' => array(
'title' => 'test',
'body' => $message
),
'url-args' => array('test'),
);