Monday, 15 March 2010

unable to get tile push notification in windows phone 8 from azure notification hub -



unable to get tile push notification in windows phone 8 from azure notification hub -

i written code send force notification windows phone 8 azure notification hub. able send toast notification windows phone 8 , windows phone 8 able notification . when sending tile notification, sending tile notification successfully, windows phone 8 not getting tile notification.

i used bindtoshelltile , bindtoshelltoast @ time of getting channel uri , after doing registration channel uri , checked idcappush_notification capabilities in windowsphone porject manifest allow force notification.

below code bind device tile , toast.

public void getnotificationchannel() { /// holds force channel created or found. httpnotificationchannel pushchannel; // name of our force channel. string channelname = "toastchannel"; // seek find force channel. pushchannel = httpnotificationchannel.find(channelname); // if channel not found, create new connection force service. if (pushchannel == null) { pushchannel = new httpnotificationchannel(channelname); // register events before attempting open channel. pushchannel.channeluriupdated += new eventhandler<notificationchannelurieventargs>(pushchannel_channeluriupdated); pushchannel.erroroccurred += new eventhandler<notificationchannelerroreventargs>(pushchannel_erroroccurred); // register notification if need receive notifications while application running. pushchannel.shelltoastnotificationreceived += new eventhandler<notificationeventargs>(pushchannel_shelltoastnotificationreceived); pushchannel.open(); // bind new channel toast , tile notifications. pushchannel.bindtoshelltoast(); pushchannel.bindtoshelltile(); } else { // channel open, register events. pushchannel.channeluriupdated += new eventhandler<notificationchannelurieventargs>(pushchannel_channeluriupdated); pushchannel.erroroccurred += new eventhandler<notificationchannelerroreventargs>(pushchannel_erroroccurred); // register notification if need receive notifications while application running. pushchannel.shelltoastnotificationreceived += new eventhandler<notificationeventargs>(pushchannel_shelltoastnotificationreceived); // display uri testing purposes. normally, uri passed web service @ point. system.diagnostics.debug.writeline(pushchannel.channeluri.tostring()); //messagebox.show(string.format("channel uri {0}", // pushchannel.channeluri.tostring())); } }

below code sued registered device in notification hub.

// notification tois nil channel uri private static async void windowsphoneregistrations(string notificationtoken) { seek { var notificationhub = getnotificationhubclient(); // wil retunr notification hub client using notificationconnectionstring // , hub path var windowsphoneregistrationdescription = await notificationhub.creatempnsnativeregistrationasync(); } grab (exception ex) { throw; } }

below code sending tile notification

private static async void sendwindowsphone8toastnotification() { seek { string windowsphone8toastfinaltemplate = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" + "<wp:notification xmlns:wp=\"wpnotification\" version=\"2.0\">" + "<wp:tile id=\"txt1\" template=\"iconictile\">" + "<wp:smalliconimage>http://flyosity.com/images/_blogentries/networkicon/step2.png</wp:smalliconimage>" + "<wp:iconimage>http://flyosity.com/images/_blogentries/networkicon/step2.png</wp:iconimage>" + "<wp:widecontent1 >this sample</wp:widecontent1>" + "<wp:count >1</wp:count>" + "<wp:title >good</wp:title>" + "</wp:tile>" + "</wp:notification>"; var notificationhub = getnotificationhubclient(); notificationoutcome n = await notificationhub.sendmpnsnativenotificationasync(httputility.htmlencode(windowsphone8toastfinaltemplate)); } grab (exception ex) { throw; } }

i able send tile notification notification hubs out exceptions , getting status notification hub after sending . device not getting tile notification.

what missed out or did error somewhere in code tile notification in windows phone 8. please help.

azure windows-phone-8 push-notification mpns

No comments:

Post a Comment