Investigating Toast Notifications
Excerpt by Ken Getz
Toast notifications are simple notifications that appear in the upper-right corner of the screen (upper-left corner for right-to-left languages); when they appear, they play a default sound. Toast notifications allow apps to communicate with users even if the user is using another app, on the Start screen, or on the Windows desktop. Actually, toast notifications are most useful when the user isn't working with the app that raised the notifications- clicking the toast redirects the user back to the app that raised the notification, and optionally (and really should) take the user to the specific part of the application that needs attention. Toast notifications can originate from a Windows Store app, from a desktop app, or from the cloud.
Investigating Toast Notifications
Toast notifications can contain text and, optionally, an image. Clicking the toast returns you to the calling application. You cannot add any other user interface elements (like buttons)-you can include text and maybe an image, and that's it! Your toast notifications can play a sound as they display, and you can select the sound from a list of available Windows sounds. The toast appears in the upper-right corner of the screen, and can be activated, dismissed, or ignored by the user. If the user clicks or taps on the toast, Windows launches the associated application. Users expect that the current view in the newly launched app corresponds with the information on the toast-if the toast indicates a new email message, for example, users expect that tapping the toast notification displays the application with the new email message selected.
To make this possible, you can specify context information in the toast to pass through to the application to set the context for the newly launched application. Think of it this way: Toast notifications provide the only means of interrupting the user's activity in one app with information from another. You should only use toast notifications for information that's of high interest to the user. Perhaps your application requires some sort of user opt-in: look at a new email message, or respond to an IM message? These are both common uses for toast notifications. Remember: because of settings, or because the user is busy, the user may never see your toast notification.
Different Types of Toast Notifications
Windows 8 provides two distinct types of toasts. The first, the standard toast notification, remains on the screen for seven seconds, and then disappears. (The user can click or tap the notification to navigate back to the original app during the time it's on screen.) The toast displays a brief sound to alert the user, although you can alter the sound, or play nothing at all. This type of toast is best for things like a social media update, or an IM sign-in. Given the two options, this is the type of toast you should use in most situations. (This is the default toast type, as well.) The second type of toast is the long-duration toast. It looks the same as the standard toast, but it remains on the screen for 25 seconds, unless the user dismisses it. You can optionally make the long-duration toast stay on screen longer, and you can loop audio.
Imagine that your application connects a VOIP call, and you need to alert the user that there's an incoming call. You need the toast notification to continue ringing, and stay visible, until the caller hangs up-that may take longer than 25 seconds. Use the long-duration toast notification when you want to grab the user's attention because a human is waiting for the user's attention. In addition to the two basic toast types, you can also create scheduled and recurring toast notifications. Toast notifications can be scheduled to appear at a specific time, and this usage is helpful for alarms, calendar reminders, and precise timing-based notifications. You can also display the toast notification multiple times (although this usage can be irritating)-this increases the user's chance of seeing the toast notification. Scheduled toast notifications require you to specify the date and time at which the toast should appear.
This post is an excerpt from the online courseware for our Windows 8 Using XAML: Views, Resources, and Toastscourse written by expert Ken Getz.
This course excerpt was originally posted July 16, 2013 from the online courseware Windows 8 Using XAML, Part 09: Views, Binding, and Templates by Ken Getz