다음을 통해 공유


Windows 앱에 대한 배지 알림

A tile with a numeric badge displaying the number 63 to indicate 63 unread mails.
숫자 배지가 표시된 타일
읽지 않은 메일 63을 나타내는 숫자 63입니다.

알림 배지는 앱에 대한 요약 또는 상태 정보를 전달합니다. 숫자(1-99) 또는 시스템 제공 문자 모양 집합 중 하나일 수 있습니다. 배지를 통해 가장 잘 전달되는 정보의 예시로는 온라인 게임의 네트워크 연결 상태, 메시징 앱의 사용자 상태, 메일 앱에서 읽지 않은 메일 수, 소셜 미디어 앱의 새 게시물 수 등이 있습니다.

알림 배지는 앱 실행 여부와 관계없이 앱의 작업 표시줄 아이콘과 시작 타일의 오른쪽 아래 모서리에 표시됩니다. 배지는 모든 타일 크기에 표시할 수 있습니다.

참고 항목

사용자 고유의 배지 이미지를 제공할 수 없습니다. 시스템 제공 배지 이미지만 사용할 수 있습니다.

숫자 배지

배지 XML
1~99 사이의 숫자입니다. 값 0은 문자 모양 값 'none'과 동일하며 배지를 지웁니다. A numeric badge less than 100. <badge value="1"/>
99보다 큰 숫자입니다. A numeric badge greater than 99. <badge value="100"/>

문자 모양 배지

배지는 숫자 대신 확장할 수 없는 상태 문자 모양 집합 중 하나를 표시할 수 있습니다.

상태 문자 모양 XML
없음 (표시되는 배지가 없습니다.) <badge value="none"/>
activity <badge value="activity"/>
경고 <badge value="alarm"/>
경고 <badge value="alert"/>
필요합니다. <badge value="attention"/>
사용 가능 <badge value="available"/>
자리 비움 <badge value="away"/>
busy <badge value="busy"/>
error <badge value="error"/>
newMessage <badge value="newMessage"/>
일시 중지됨 <badge value="paused"/>
재생 중 <badge value="playing"/>
unavailable <badge value="unavailable"/>

배지 생성

다음 예에서는 배지 업데이트를 만드는 방법을 보여 줍니다.

숫자 배지 생성

private void setBadgeNumber(int num)
{

    // Get the blank badge XML payload for a badge number
    XmlDocument badgeXml = 
        BadgeUpdateManager.GetTemplateContent(BadgeTemplateType.BadgeNumber);

    // Set the value of the badge in the XML to our number
    XmlElement badgeElement = badgeXml.SelectSingleNode("/badge") as XmlElement;
    badgeElement.SetAttribute("value", num.ToString());

    // Create the badge notification
    BadgeNotification badge = new BadgeNotification(badgeXml);

    // Create the badge updater for the application
    BadgeUpdater badgeUpdater = 
        BadgeUpdateManager.CreateBadgeUpdaterForApplication();

    // And update the badge
    badgeUpdater.Update(badge);

}

문자 모양 배지 생성

private void updateBadgeGlyph()
{
    string badgeGlyphValue = "alert";

    // Get the blank badge XML payload for a badge glyph
    XmlDocument badgeXml = 
        BadgeUpdateManager.GetTemplateContent(BadgeTemplateType.BadgeGlyph);

    // Set the value of the badge in the XML to our glyph value
    Windows.Data.Xml.Dom.XmlElement badgeElement = 
        badgeXml.SelectSingleNode("/badge") as Windows.Data.Xml.Dom.XmlElement;
    badgeElement.SetAttribute("value", badgeGlyphValue);

    // Create the badge notification
    BadgeNotification badge = new BadgeNotification(badgeXml);

    // Create the badge updater for the application
    BadgeUpdater badgeUpdater = 
        BadgeUpdateManager.CreateBadgeUpdaterForApplication();

    // And update the badge
    badgeUpdater.Update(badge);

}

배지 삭제

private void clearBadge()
{
    BadgeUpdateManager.CreateBadgeUpdaterForApplication().Clear();
}

샘플 코드 가져오기

  • 알림 샘플
    라이브 타일을 생성하고, 배지 업데이트를 보내고, 알림 메시지를 표시하는 방법을 보여 줍니다.