How to schedule a tile notification (HTML)
This topic shows how to schedule a tile notification to appear at a specific time.
- Windows Runtime
- A working knowledge of tile and notification terms and concepts. For more information, see Tiles, Badges, and Notifications.
Before you can specify the delivery time, you must create the notification.
var template = Windows.UI.Notifications.Tile.tileSquare150x150Text01; var tileXml = Windows.UI.Notifications.TileUpdateManager.getTemplateContent(template);
We won't cover this here because it's the same for a scheduled notification as for a non-scheduled notification. For more information, see Quickstart: Sending a tile update.
var currentTime = new Date(); var startTime = new Date(currentTime.getTime() + 3 * 1000);
Send the tile notification content and the scheduled delivery time to the constructor.
var scheduledTile = new Windows.UI.Notifications.ScheduledTileNotification(tileXml, startTime);
This ID must be 16 characters or less.
Create the TileUpdater object, which in turn is used to add your notification to the schedule.
var tileUpdater = Windows.UI.Notifications.TileUpdateManager.createTileUpdaterForApplication(); tileUpdater.addToSchedule(scheduledTile);