BadgeUpdater BadgeUpdater BadgeUpdater BadgeUpdater Class

Definition

Updates a badge overlay on the specific tile that the updater is bound to.

public : sealed class BadgeUpdater : IBadgeUpdaterpublic sealed class BadgeUpdater : IBadgeUpdaterPublic NotInheritable Class BadgeUpdater Implements IBadgeUpdater// You can use this class in JavaScript.
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0 - for Xbox, see UWP features that aren't yet supported on Xbox)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Examples

The following example shows the use of Update to send a numeric badge update to the calling app's tile.


function sendBadgeNotification() {
    var Notifications = Windows.UI.Notifications;
    var badgeXml;
    var badgeAttributes;

    // Get an XML DOM version of a specific template by using getTemplateContent.
    badgeXml = Notifications.BadgeUpdateManager.getTemplateContent(Notifications.BadgeTemplateType.badgeNumber);
    badgeAttributes = badgeXml.getElementsByTagName("badge");
    badgeAttributes[0].setAttribute("value", "7");

    // Create a badge notification from the XML content.
    var badgeNotification = new Notifications.BadgeNotification(badgeXml);

    // Send the badge notification to the app's tile.
    Notifications.BadgeUpdateManager.createBadgeUpdaterForApplication().update(badgeNotification);
}

Remarks

To get an instance of this object, call the BadgeUpdateManager.CreateBadgeUpdaterForApplication or BadgeUpdateManager.CreateBadgeUpdaterForSecondaryTile method.

When it is created, BadgeUpdater is bound to a specific app or secondary tile, so the methods of this class affect only the single tile that the object instance is bound to.

Methods

Clear() Clear() Clear() Clear()

Removes the badge from the tile that the updater is bound to.

public : void Clear()public void Clear()Public Function Clear() As void// You can use this method in JavaScript.

Remarks

The badge can also be cleared by setting the badge value to "0" or "none".

Note

If your badge is using periodic updates, you must also call StopPeriodicUpdate or the badge will reappear at the next polling interval.

See Also

StartPeriodicUpdate(Uri, DateTime, PeriodicUpdateRecurrence) StartPeriodicUpdate(Uri, DateTime, PeriodicUpdateRecurrence) StartPeriodicUpdate(Uri, DateTime, PeriodicUpdateRecurrence) StartPeriodicUpdate(Uri, DateTime, PeriodicUpdateRecurrence)

Begins a series of timed updates for the badge from a web resource that the updater is bound to. Updates begin at a specified time. Note that only web resources (http/https) are allowed in a periodic update.

public : void StartPeriodicUpdate(Uri badgeContent, DateTime startTime, PeriodicUpdateRecurrence requestedInterval)public void StartPeriodicUpdate(Uri badgeContent, DateTimeOffset startTime, PeriodicUpdateRecurrence requestedInterval)Public Function StartPeriodicUpdate(badgeContent As Uri, startTime As DateTimeOffset, requestedInterval As PeriodicUpdateRecurrence) As void// You can use this method in JavaScript.
Parameters
badgeContent
Uri Uri Uri Uri

The Uniform Resource Identifier (URI) from which the XML content of the badge update will be retrieved.

startTime
DateTime DateTimeOffset DateTimeOffset DateTimeOffset

The time at which the Uniform Resource Identifier (URI) should first be polled for new badge content.

requestedInterval
PeriodicUpdateRecurrence PeriodicUpdateRecurrence PeriodicUpdateRecurrence PeriodicUpdateRecurrence

The frequency with which the Uniform Resource Identifier (URI) is polled for new badge content, following the initial update at startTime.

See Also

StartPeriodicUpdate(Uri, PeriodicUpdateRecurrence) StartPeriodicUpdate(Uri, PeriodicUpdateRecurrence) StartPeriodicUpdate(Uri, PeriodicUpdateRecurrence) StartPeriodicUpdate(Uri, PeriodicUpdateRecurrence)

Begins a series of timed updates for the badge from a web resource that the updater is bound to, beginning immediately. Note that only web resources (http/https) are allowed in a periodic update.

public : void StartPeriodicUpdate(Uri badgeContent, PeriodicUpdateRecurrence requestedInterval)public void StartPeriodicUpdate(Uri badgeContent, PeriodicUpdateRecurrence requestedInterval)Public Function StartPeriodicUpdate(badgeContent As Uri, requestedInterval As PeriodicUpdateRecurrence) As void// You can use this method in JavaScript.
Parameters
badgeContent
Uri Uri Uri Uri

The Uniform Resource Identifier (URI) from which the XML content of the badge update will be retrieved.

requestedInterval
PeriodicUpdateRecurrence PeriodicUpdateRecurrence PeriodicUpdateRecurrence PeriodicUpdateRecurrence

The frequency with which the Uniform Resource Identifier (URI) is polled for new badge content.

See Also

StopPeriodicUpdate() StopPeriodicUpdate() StopPeriodicUpdate() StopPeriodicUpdate()

Cancels the current series of timed updates for the badge that the updater is bound to.

public : void StopPeriodicUpdate()public void StopPeriodicUpdate()Public Function StopPeriodicUpdate() As void// You can use this method in JavaScript.
See Also

Update(BadgeNotification) Update(BadgeNotification) Update(BadgeNotification) Update(BadgeNotification)

Applies a change to the badge's glyph or number.

public : void Update(BadgeNotification notification)public void Update(BadgeNotification notification)Public Function Update(notification As BadgeNotification) As void// You can use this method in JavaScript.
Parameters
notification
BadgeNotification BadgeNotification BadgeNotification BadgeNotification

The object that supplies the new XML definition for the badge.

Examples

The following example shows the use of Update to send a numeric badge update to the calling app's tile.



function sendBadgeNotification() {

    var Notifications = Windows.UI.Notifications;

    var badgeXml;

    var badgeAttributes;



    // Get an XML DOM version of a specific template by using getTemplateContent.

    badgeXml = Notifications.BadgeUpdateManager.getTemplateContent(Notifications.BadgeTemplateType.badgeNumber);

    badgeAttributes = badgeXml.getElementsByTagName("badge");

    badgeAttributes[0].setAttribute("value", "7");



    // Create a badge notification from the XML content.

    var badgeNotification = new Notifications.BadgeNotification(badgeXml);



    // Send the badge notification to the app's tile.

    Notifications.BadgeUpdateManager.createBadgeUpdaterForApplication().update(badgeNotification);

}
See Also

See Also