ToastNotificationManager.CreateToastNotifier 메서드

정의

오버로드

CreateToastNotifier()

알림 메시지를 해당 앱에 발생시킬 수 있는 호출 애플리케이션에 바인딩된 ToastNotification의 새 instance 만들고 초기화합니다.

CreateToastNotifier(String)

지정된 앱( 일반적으로 동일한 패키지의 다른 앱)에 바인딩된 ToastNotification의 새 instance 만들고 초기화합니다.

CreateToastNotifier()

알림 메시지를 해당 앱에 발생시킬 수 있는 호출 애플리케이션에 바인딩된 ToastNotification의 새 instance 만들고 초기화합니다.

public:
 static ToastNotifier ^ CreateToastNotifier();
/// [Windows.Foundation.Metadata.Overload("CreateToastNotifier")]
 static ToastNotifier CreateToastNotifier();
[Windows.Foundation.Metadata.Overload("CreateToastNotifier")]
public static ToastNotifier CreateToastNotifier();
function createToastNotifier()
Public Shared Function CreateToastNotifier () As ToastNotifier

반환

앱에 알림 메시지를 보내는 데 사용할 개체입니다.

특성

예제

다음 예제에서는 CreateToastNotifier 메서드 사용을 포함하여 텍스트 및 이미지가 포함된 알림 메시지를 만들고 보내는 방법을 보여 줍니다.

var notifications = Windows.UI.Notifications;

// Get the toast notification manager for the current app.
var notificationManager = notifications.ToastNotificationManager;

// The getTemplateContent method returns a Windows.Data.Xml.Dom.XmlDocument object
// that contains the toast notification XML content.
var template = notifications.toastTemplateType.toastImageAndText01;
var toastXml = notificationManager.getTemplateContent(notifications.ToastTemplateType[template]);

// You can use the methods from the XML document to specify the required elements for the toast.
var images = toastXml.getElementsByTagName("image");
images[0].setAttribute("src", "images/toastImageAndText.png");

var textNodes = toastXml.getElementsByTagName("text");
textNodes.forEach(function (value, index) {
    var textNumber = index + 1;
    var text = "";
    for (var j = 0; j < 10; j++) {
        text += "Text input " + /*@static_cast(String)*/textNumber + " ";
    }
    value.appendChild(toastXml.createTextNode(text));
});

// Create a toast notification from the XML, then create a ToastNotifier object
// to send the toast.
var toast = new notifications.ToastNotification(toastXml);

notificationManager.createToastNotifier().show(toast);

설명

데스크톱 앱에 대한 알림 알림을 만들 때는 이 오버로드를 사용하지 마세요. CreateToastNotifier(appID)를 사용하여 필요한 AppUserModelID를 제공합니다.

앱이 VOIP(백그라운드 음성 인터넷 프로토콜) 에이전트를 사용하는 경우 알림을 표시할 앱 ID를 지정해야 합니다. CreateToastNotifier(appID) 메서드 오버로드를 사용합니다.

추가 정보

적용 대상

CreateToastNotifier(String)

지정된 앱( 일반적으로 동일한 패키지의 다른 앱)에 바인딩된 ToastNotification의 새 instance 만들고 초기화합니다.

public:
 static ToastNotifier ^ CreateToastNotifier(Platform::String ^ applicationId);
/// [Windows.Foundation.Metadata.Overload("CreateToastNotifierWithId")]
 static ToastNotifier CreateToastNotifier(winrt::hstring const& applicationId);
[Windows.Foundation.Metadata.Overload("CreateToastNotifierWithId")]
public static ToastNotifier CreateToastNotifier(string applicationId);
function createToastNotifier(applicationId)
Public Shared Function CreateToastNotifier (applicationId As String) As ToastNotifier

매개 변수

applicationId
String

Platform::String

winrt::hstring

앱의 고유 ID입니다.

참고

보조 타일에 알림 메시지를 보낼 수 없으므로 앱 타일의 ID여야 합니다.

반환

타일에 알림 메시지를 보내는 데 사용할 개체입니다.

특성

설명

applicationId로 식별된 앱은 호출자와 동일한 패키지에 속해야 합니다.

앱이 VOIP(백그라운드 음성 인터넷 프로토콜) 에이전트를 사용하는 경우 이 형식의 메서드를 사용하여 이 경우 알림을 표시하는 데 필요한 앱 ID를 지정합니다.

데스크톱 앱에서 알림 메시지 보내기

일반적으로 데스크톱 앱에서 알림 메시지를 보내는 것은 UWP 앱에서 보내는 것과 같습니다. 그러나 다음과 같은 차이점과 요구 사항을 알고 있어야 합니다.

  • 데스크톱 앱이 알림을 표시하려면 앱에 시작 화면에 바로 가기가 있어야 합니다.
  • 바로 가기에는 AppUserModelID가 있어야 합니다.
  • 데스크톱 앱은 알림을 예약할 수 없습니다.

자세한 내용은 다음 항목을 참조하세요.

추가 정보

적용 대상