Updating the badge in a Windows 8 JavaScript App

Windows 8 apps can have notification badges in the tiles. It’s easy to update the badge, but it’s still not well documented, so here is a small snippet to show you how it’s done:

var Notifications = Windows.UI.Notifications;
var updater = Notifications.BadgeUpdateManager.createBadgeUpdaterForApplication();
var xml = Notifications.BadgeUpdateManager.getTemplateContent(

xml.getElementsByTagName('badge')[0].setAttribute('value', 5);

var notification = Notifications.BadgeNotification(xml);

Replace the 5 in line 7 with the number of your choice. The end result looks like this:

Badge update example

More info on badge updates is available in the Windows.UI.Notifications namespace of the WinRT and the Badge Update XML Schema.

  • Hola alguien conoce esta pagina? http://www.ganadineroconmry.com
    Necesito saber si lo que muestran alli es real. Quiero ganar dinero!Muchas gracias.
    Yamile LindaMedellin.

  • guest

    Hey awesome job, Do you know how to make the tile update with information that is inside the app for example an RSS reader app displaying the latest’s headlines in the tile?