回答

0

你喲使用ScheduledToastNotification

下面的示例演示計劃在一小時內顯示Toast通知。

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

你有duetime參數和吐司ID工作

相關問題