ScheduledToastNotification Class

Definition

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

public ref class ScheduledToastNotification sealed
/// [Windows.Foundation.Metadata.Activatable(Windows.UI.Notifications.IScheduledToastNotificationFactory, 65536, Windows.Foundation.UniversalApiContract)]
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.MTA)]
class ScheduledToastNotification final
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.MTA)]
/// [Windows.Foundation.Metadata.Activatable(Windows.UI.Notifications.IScheduledToastNotificationFactory, 65536, "Windows.Foundation.UniversalApiContract")]
class ScheduledToastNotification final
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.MTA)]
/// [Windows.Foundation.Metadata.Activatable(Windows.UI.Notifications.IScheduledToastNotificationFactory, 65536, "Windows.Foundation.UniversalApiContract")]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class ScheduledToastNotification final
[Windows.Foundation.Metadata.Activatable(typeof(Windows.UI.Notifications.IScheduledToastNotificationFactory), 65536, typeof(Windows.Foundation.UniversalApiContract))]
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.MTA)]
public sealed class ScheduledToastNotification
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.MTA)]
[Windows.Foundation.Metadata.Activatable(typeof(Windows.UI.Notifications.IScheduledToastNotificationFactory), 65536, "Windows.Foundation.UniversalApiContract")]
public sealed class ScheduledToastNotification
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.MTA)]
[Windows.Foundation.Metadata.Activatable(typeof(Windows.UI.Notifications.IScheduledToastNotificationFactory), 65536, "Windows.Foundation.UniversalApiContract")]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public sealed class ScheduledToastNotification
function ScheduledToastNotification(content, deliveryTime, snoozeInterval, maximumSnoozeCount)
Public NotInheritable Class ScheduledToastNotification
Inheritance
Object Platform::Object IInspectable ScheduledToastNotification
Attributes

Windows requirements

Device family
Windows 10 (introduced in 10.0.10240.0 - for Xbox, see UWP features that aren't yet supported on Xbox)
API contract
Windows.Foundation.UniversalApiContract (introduced in v1.0)

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);

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

Constructors

ScheduledToastNotification(XmlDocument, DateTime)

Creates and initializes a new instance of a ScheduledToastNotification that will be displayed only once.

ScheduledToastNotification(XmlDocument, DateTime, TimeSpan, UInt32)

Deprecated in Windows 10. On Windows 8 systems, creates and initializes a new instance of a ScheduledToastNotification that re-appears after a specified time after initially appearing. On Windows 10, this functions equivalently to ScheduledToastNotification(XmlDocument, DateTime). To achieve the same snooze interval behavior in Windows 10, you can use buttons on your toasts.

Properties

Content

Gets the XML that defines this scheduled toast notification.

DeliveryTime

Gets the time that this toast notification is scheduled to be displayed.

ExpirationTime

Gets or sets the expiration time of the notification.

Group

Gets or sets the group identifier for the notification.

Id

Gets a developer-specified value used to identify a specific scheduled toast.

MaximumSnoozeCount

Gets the maximum number of times to display this notification.

NotificationMirroring

Gets or sets a value that specifies whether notification mirroring is enabled. (Notification mirroring enables a notification to appear on multiple devices.)

RemoteId

Gets or sets a remote id for the notification that enables the system to correlate this notification with another one generated on another device.

SnoozeInterval

Gets the amount of time between occurrences of the notification.

SuppressPopup

Gets or sets whether a toast's pop-up UI is displayed on the user's screen.

Tag

Gets or sets a string that uniquely identifies a toast notification inside a Group.

Applies to

See also