BadgeUpdater BadgeUpdater BadgeUpdater BadgeUpdater Class

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

Syntax

Declaration

public sealed class BadgeUpdaterpublic sealed class BadgeUpdaterPublic NotInheritable Class BadgeUpdater

Remarks

To get an instance of this object, call the CreateBadgeUpdaterForApplication() or CreateBadgeUpdaterForSecondaryTile(System.String) 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.

Examples

The following example shows the use of Update(Windows.UI.Notifications.BadgeNotification) 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);
}

Methods summary

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

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.

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.

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

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

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

    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.

  • StartPeriodicUpdate(Windows.Foundation.Uri,Windows.Foundation.DateTime,Windows.UI.Notifications.PeriodicUpdateRecurrence)
    StartPeriodicUpdate(Windows.Foundation.Uri,Windows.Foundation.DateTime,Windows.UI.Notifications.PeriodicUpdateRecurrence)
    StartPeriodicUpdate(Windows.Foundation.Uri,Windows.Foundation.DateTime,Windows.UI.Notifications.PeriodicUpdateRecurrence)
    StartPeriodicUpdate(Windows.Foundation.Uri,Windows.Foundation.DateTime,Windows.UI.Notifications.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(Windows.Foundation.Uri badgeContent,Windows.Foundation.DateTime startTime,Windows.UI.Notifications.PeriodicUpdateRecurrence requestedInterval)public void StartPeriodicUpdate(Windows.Foundation.Uri badgeContent,Windows.Foundation.DateTime startTime,Windows.UI.Notifications.PeriodicUpdateRecurrence requestedInterval)Public Function StartPeriodicUpdate(badgeContent As Windows.Foundation.Uri,startTime As Windows.Foundation.DateTime,requestedInterval As Windows.UI.Notifications.PeriodicUpdateRecurrence) As void

    Parameters

  • StartPeriodicUpdate(Windows.Foundation.Uri,Windows.UI.Notifications.PeriodicUpdateRecurrence)
    StartPeriodicUpdate(Windows.Foundation.Uri,Windows.UI.Notifications.PeriodicUpdateRecurrence)
    StartPeriodicUpdate(Windows.Foundation.Uri,Windows.UI.Notifications.PeriodicUpdateRecurrence)
    StartPeriodicUpdate(Windows.Foundation.Uri,Windows.UI.Notifications.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(Windows.Foundation.Uri badgeContent,Windows.UI.Notifications.PeriodicUpdateRecurrence requestedInterval)public void StartPeriodicUpdate(Windows.Foundation.Uri badgeContent,Windows.UI.Notifications.PeriodicUpdateRecurrence requestedInterval)Public Function StartPeriodicUpdate(badgeContent As Windows.Foundation.Uri,requestedInterval As Windows.UI.Notifications.PeriodicUpdateRecurrence) As void

    Parameters

  • 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
  • Update(Windows.UI.Notifications.BadgeNotification)
    Update(Windows.UI.Notifications.BadgeNotification)
    Update(Windows.UI.Notifications.BadgeNotification)
    Update(Windows.UI.Notifications.BadgeNotification)

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

    public void Update(Windows.UI.Notifications.BadgeNotification notification)public void Update(Windows.UI.Notifications.BadgeNotification notification)Public Function Update(notification As Windows.UI.Notifications.BadgeNotification) As void

    Parameters

    Remarks

    Examples

    The following example shows the use of Update(Windows.UI.Notifications.BadgeNotification) 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);
    }
    

Device family

Windows 10 (introduced v10.0.10240.0)

API contract

Windows.Foundation.UniversalApiContract (introduced v1)

Attributes

Windows.Foundation.Metadata.ContractVersionAttribute
Windows.Foundation.Metadata.MuseAttribute

Details

Assembly

Windows.UI.Notifications.dll