I. FORM of notification
In the WindowsPhone system, notifications have many forms, such as
(Tile tile has been reviewed in the previous blog post, badge form similar to tile)
1. Toast
It is mainly written using an XML file, with the following XML code:
1 <Toast>2 <Visual>3 <bindingTemplate= "ToastText02">4 <textID= "1">Headline text</text> 5 <textID= "2">Body text</text>6 </binding>7 </Visual>8 </Toast>
Note that you need to apply a toast to your app in the app manifest settings, such as
Ii. Methods of Notification
There are also a number of ways to push notifications
1. Scheduled (as planned)
Set tile,toast template and update time, mainly apply Scheduledtilenotification class and Scheduledtoastnotification class, the demo code is as follows:
var New scheduledtoastnotification ( xmldoc, + timespan.fromdays (1.0)); var toastnotify = toastnotificationmanager.createtoastnotifier (); Toastnotify.addtoschedule ( Scheduletoast);
2, Periodic (using the corresponding server to provide regular updates of data)
The demo code is as follows:
var periodic =new Uri ("http://mysite.com/tileRSS.xml"); Periodic. Startperiodicupdate (Mytilefeed, periodicupdaterecurrence.hour);
The above is the use of their own server address to obtain the tile format file, in addition to the application of the list of settings, such as
3. Local (update locally)
Local updates primarily take advantage of background tasks (Backgroundtask)
Badge update the demo code as follows
New= badgeupdatemanager.createbadgeupdaterforapplication (); update. Update (Newbadge);
4. WNS Server Push
Use Microsoft Notification Server push notifications, this is a push-to-send
Http://pushtestserver.azurewebsites.net/wns/demo Example
wp8.1 Study19: Notice