我想在我的 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 桌面上为我工作,但是当我在模拟器中运行它时,它没有显示徽章文本。任何人都可以帮我解决这个问题