Badge notifications is not appearing on icon

Alumni Comp 16 LAXMI SWAMI 46 Reputation points
2020-07-31T13:28:22.403+00:00

I am using this piece of code to show badge count in my uwp app (Windows specification version - 1903)

Windows.Data.Xml.Dom.XmlDocument badgeXml = BadgeUpdateManager.GetTemplateContent(BadgeTemplateType.BadgeGlyph);
Windows.Data.Xml.Dom.XmlElement badgeElement = badgeXml.SelectSingleNode("/badge") as Windows.Data.Xml.Dom.XmlElement;
badgeElement.SetAttribute("value", ObjFactory.Instance.CreateRuntimeData().BadgeMessageCount.ToString());
BadgeNotification badge = new BadgeNotification(badgeXml);
BadgeUpdater badgeUpdater = BadgeUpdateManager.CreateBadgeUpdaterForApplication();
badgeUpdater.Update(badge);
This code initially shows badge count properly but sometime it disappear suddenly most of the time after exiting the application.

So is there anything changed in code because code runs properly but doesn't show badge count or is there any issue at the system level?

Universal Windows Platform (UWP)
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.