共用方式為


Sending toast notifications (XAML)

Note  Not using C#/VB/C++? See Sending toast notifications (HTML).

 

This section shows you how to define and send a toast notification, which is a pop-up notification that allows the app to communicate with the user whether the user is in another app, on the Start screen, or on the desktop. These actions are demonstrated using local notifications, which are the simplest notifications to implement. Once you understand the basics of toast construction and use, you can apply that knowledge to sending notifications through the other delivery methods: scheduled, periodic, and push. For more information, see Delivering notifications.

The following roadmap suggests a path you should follow when learning about defining and sending toast notifications:

  1. Individual topics in this section will give some basic conceptual information, but most assume that you already have some knowledge of the topic. If you are new to this feature, you should first familiarize yourself with toast notification terms and concepts so that you have the big picture of what can be done with them and how the parts all fit together. This conceptual material is found in the Toast notification overview.
  2. Next, you should go over the Guidelines and checklist for toast notifications to familiarize yourself with best practices that you will employ in your code and in your use of these notifications.
  3. Now it's time to get into the code. The first step is to declare that your app can send and receive toast notifications. This is done in your app's manifest. For more information, How to opt in for toast notifications.
  4. Next, you will construct and send your toast. Quickstart: Sending a toast notification is your first step in understanding how to do so. This Quickstart walks you through the full process, from defining a toast's XML content to sending that content as a local notification.
  5. When the user taps or clicks your toast, generally your app is launched into a view related to the content of the notification. For more information, see How to handle activation from a toast notification.

Note  Action center is a feature in Windows Phone 8.1 that enables users to quickly access phone settings of their choice, as well as their toast notifications. APIs and new WNS request headers have been added to help you manage your toast notifications in action center. For more information, see Managing toast notifications in action center.

In this section

Topic Description

Quickstart: Sending a toast notification

A toast notification is a pop-up UI that appears on your screen to allow your app to communicate with the user when the user is in another app, on the Start screen, or, in the case of Windows, on the desktop. This Quickstart walks you through the steps to define and display toast content.

How to opt in for toast notifications

This topic explains how to specify that your app is capable of raising toast notifications.

How to handle activation from a toast notification

This topic demonstrates the actions you should take in response to a user clicking on a toast notification sent from your app. Your app should respond by displaying UI specific to the toast. The app should typically launch in a context or view that is related to the toast's content.

Managing toast notifications in action center

Action center, introduced in Windows Phone 8.1, enables users to quickly access certain system settings of their choice, as well as their toast notifications.

 

Toast notifications sample

Managing toast notifications in action center