This sample shows you how to use toast notifications, which are notifications sent from an app to the user. Toast appears as a pop-up notification in the upper right corner of the screen. A user can select the toast (touch or click) to launch the associated app. Toast notifications can be sent locally or through a web service. This sample demonstrates the functionality and features of local toast notifications and lets you preview all the toast template types.

The sample demonstrates the following scenarios:

To see a sample of toast used as an alarm, download the Alarm toast notification sample.

For an app to send a toast notification, the developer must have declared that the app is toast-capable in its app manifest file (package.appxmanifest), as they have for this sample app. Normally, you will do this through the Microsoft Visual Studio 2013 manifest editor, where you find the setting in the Application tab, under the Notifications section. For more information, see How to opt in for toast notifications.

For any functionality that involves non-local content, the developer must have declared the "Internet (Client)" capability in the app's manifest. In the Visual Studio 2013 manifest editor, this option is under the Capabilities tab.

To obtain an evaluation copy of Windows 8.1, go to Windows 8.1.

To obtain an evaluation copy of Visual Studio 2013, go to Visual Studio 2013.

Note  For Windows 8 app samples, download the Windows 8 app samples pack. The samples in the Windows 8 app samples pack will build and run only on Microsoft Visual Studio 2012.

Related topics

Overviews
Toast notifications (concepts)
The toast notification template catalog
JavaScript/HTML tutorials
Quickstart: Sending a toast notification
How to opt in for toast notifications
How to handle activation from a toast notification
C#/C++/XAML tutorials
Quickstart: Sending a toast notification
How to opt in for toast notifications
How to handle activation from a toast notification
Reference
Windows.UI.Notifications namespace

Operating system requirements

Client
Windows 8.1
Server
Windows Server 2012 R2

Build the sample

  1. Download the sample's .zip file using one of the buttons near the top of the page.
  2. Unzip the downloaded file into a folder on your computer.
  3. Start Visual Studio 2013 and select File > Open > Project/Solution.
  4. Go to the folder where you unzipped the sample.
  5. Find and open the folder named for the sample and one of its programming language subfolders (C#, JS.
  6. Double-click the Microsoft Visual Studio Solution (.sln) file to open it.
  7. Select Build > Build Solution to build the sample.

Run the sample

To debug the app and then run it, press F5 or use Debug > Start Debugging. To run the app without debugging, press Ctrl+F5 or use Debug > Start Without Debugging.

How to use the sample

As you send the toast notifications from the different scenarios, watch for them to appear in the upper-right corner of the screen. Each toast will be dismissed by the system after a few seconds, but you can also manually dismiss them with a swipe or a click.