徽章到我的Windows 8应用程序中的瓷砖

时间:2013-05-08 09:54:32

标签: javascript html5 windows-8

我想在我的Windows 8应用程序中向徽标显示徽章。我尝试了以下代码而没有在徽标中获取徽章。没有出现错误。我没有得到问题所在。我坚持了2个小时。

 var notifications = Windows.UI.Notifications;  
 var badgeType = notifications.BadgeTemplateType.badgeNumber;   
 var badgeXml = notifications.BadgeUpdateManager.getTemplateContent(badgeType);   
 var badgeAttributes = badgeXml.getElementsByTagName("badge");    
 badgeAttributes[0].setAttribute("value", "7");    
 var badgeNotification = new notifications.BadgeNotification(badgeXml);
 notifications.BadgeUpdateManager.createBadgeUpdaterForApplication().update(badgeNotification);

更新

您好上面的代码在windows8桌面上为我工作但是当我在模拟器中运行时它没有显示徽章文本。任何人都可以帮我这个

1 个答案:

答案 0 :(得分:0)

不幸的是,所有通知API(Toast,tile,badge和推送通知)在Windows 8 Simulator中都不起作用。要进行测试和调试,请使用“本地计算机”作为目标。