windows phone 8 - Couldn't send push notification using Azure Notification Hubs -
i trying create notification bus send push notifications windows phone app.
i referred link , followed steps.
my application registering httpchannel
var channel = httpnotificationchannel.find("mypushchannel"); if (channel == null) { channel = new httpnotificationchannel("mypushchannel"); channel.open(); channel.bindtoshelltoast(); } channel.channeluriupdated += async (o, args) => { var hub = new notificationhub("xyz", "endpoint=sb://xyz-ns.servicebus.windows.net/;sharedaccesskeyname=defaultlistensharedaccesssignature;sharedaccesskey=dwnotqgqiksdstpxx4kuyebplsdslfep2yzimw1dmeu="); await hub.registernativeasync(args.channeluri.tostring()); };
and console application
private static async void sendnotificationasync() { var hub = notificationhubclient .createclientfromconnectionstring("endpoint=sb://xyz-ns.servicebus.windows.net/;sharedaccesskeyname=defaultfullsharedaccesssignature;sharedaccesskey=6p1isg5uv97hjxrqbvj11yjl+uv49rtsznaljaovczi=", "xyz"); const string toast = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" + "<wp:notification xmlns:wp=\"wpnotification\">" + "<wp:toast>" + "<wp:text1>hello .net app!</wp:text1>" + "</wp:toast> " + "</wp:notification>"; await hub.sendmpnsnativenotificationasync(toast); }
i have enabled unauthorized notifications in portal. when run console application, unable notification.
and console application looks
static void main() { sendnotificationasync(); }
can me need fix this?
Comments
Post a Comment