Skip to content

Latest commit

 

History

History
55 lines (40 loc) · 2.36 KB

scheduledtoastnotification.md

File metadata and controls

55 lines (40 loc) · 2.36 KB
-api-id -api-type -api-device-family-note
T:Windows.UI.Notifications.ScheduledToastNotification
winrt class
xbox

Windows.UI.Notifications.ScheduledToastNotification

-description

Contains the XML that defines the toast notification that will display at the scheduled time.

-remarks

Create and initialize a new instance of this object by calling ScheduledToastNotification.

Version history

Windows version SDK version Value added
1607 14393 NotificationMirroring
1607 14393 RemoteId
1803 17134 ExpirationTime

-examples

The following example shows a toast notification scheduled to display in one hour.

var Notifications = Windows.UI.Notifications;
var currentTime = new Date();
var seconds = 60;
var dueTime = new Date(currentTime.getTime() + seconds * 60 * 1000);
var idNumber = Math.floor(Math.random() * 100000000);  // Generates a unique ID number for the notification.

// Set up the notification text.
var toastXml = Notifications.ToastNotificationManager.getTemplateContent(Notifications.ToastTemplateType.toastText02);
var strings = toastXml.getElementsByTagName("text");
strings[0].appendChild(toastXml.createTextNode(This is a scheduled toast notification));
strings[1].appendChild(toastXml.createTextNode("Received: " + dueTime.toLocaleTimeString()));

// Create the toast notification object.
var toast = new Notifications.ScheduledToastNotification(toastXml, dueTime);
toast.id = "Toast" + idNumber;

// Add to the schedule.
Notifications.ToastNotificationManager.createToastNotifier().addToSchedule(toast);

-see-also

Scheduled notifications sample, Toast schema, Guidelines and checklist for scheduled notifications