Monday, December 31, 2012
Windows 8 Application tile update
Ref:
http://msdn.microsoft.com/en-us/library/windows/apps/hh761490.aspx
Updating notification tile:
//1. Choose a tile contents template:
var tmpl = Windows.UI.Notifications.TileTemplateType.tileWideImageAndText01;
//2. Get tile xml dom:
var xml = Windows.UI.Notifications.TileUpdateManager.getTemplateContent( tmpl )
//3. Update text:
var txt = xml.getElementsByTagName("text");
txt[0].appendChild( xml.createTextNode("Hello World") );
//4. UpdateImage:
var img = xml.getElementsByTagName("img");
img[0].setAttribute("src", "ms-appx:///images/logo.png");
//5. Create a notification via the new xml and set it to expire in 10 minutes:
var notification = new Windows.UI.Notifications.TileNotification( xml );
notification.expirationTime = new Date( (new Date()).getTime() + 600 * 1000 );
//6. Send the tile update
Windows.UI.Notifications.TileUpdateManager.createTileUpdateForApplication().update(notification);
Subscribe to:
Posts (Atom)