Plugging in notification services for Windows8, using azure was easy. So it should be the same for phone 8 right? Well we were wrong. A day later we got it waxed, but for the life of me i cant figure out why it has to be like this - perhaps i missed something.
Anyway we configured a notification table in Azure mobile services with an insert java script trigger. using the push.mpns library. The sendFlipTile works, but sendToast did not.
A work around is this code (highlighted) instead of the "out of the box" push.mpns tutorials that you find that in the insert operation (credit must go to Jeff Wilcox: http://www.jeff.wilcox.name/2011/12/node-mpns/)
function insert(item, user, request) {
request.execute({
success: function() {
request.respond();
sendNotifications();
}
});
function sendNotifications() {
var channelTable = tables.getTable('Channel');
channelTable.read({
success: function(channels) {
channels.forEach(function(channel) {
if(channel.isPhone===true)
{
var mpns = require('mpns');
var options = { text1: item.Heading , text2: item.Description };
var toast = new mpns.toast(options);
toast.send(channel.Uri,
function(err,res){
if(err)
{
console.log("Err push P8:", err);
}
else
{
console.log("Sent push P8:", res);
}
}
);
}
else
{
push.wns.sendToastText02(
channel.Uri,
{
text1: item.Heading,
text2: item.Description
},
{
success: function(pushResponse)
{
console.log("Sent push W8:", pushResponse);
}
}
);
}
});
}
});
}
}
hope it helps
No comments:
Post a Comment