다음을 통해 공유


Working with tiles, badges, and toast notifications (XAML)

Note  Not using C#/VB/C++? See Working with tiles, badges, and toast notifications (HTML).

 

The topics contained in this section demonstrate concrete tasks that you'll commonly perform when designing your tiles, updating those tiles and their badges through notifications, designing and sending toast notifications, and interacting with the lock screen.

In these topics, we'll discuss these elements:

  • Tiles, which are an app's representation on the Start screen. Tiles can be "live", which means that the content that they display can change in response to notifications. An app can also have one or more secondary tiles, which provide direct links into specific views or experiences within the app.
  • Badges, which are shown on tiles to indicate an app's state or status. You can set the badge to show either a number or a small image (glyph), depending on the information that you want to convey.
  • Toast notifications, which are app-specific, pop-up notifications.

Each of these elements can be updated through several notification mechanisms:

  • Local notifications, which use only text and images present on the device. These notifications can appear as needed or be scheduled to appear at a specific time.
  • Periodic notifications, which use text and images retrieved on a regular basis from a cloud-based service.
  • Push notifications, which send text and images from a cloud server to the user's device through the Windows Push Notification Services (WNS).

What you'll find in both creating and delivering notifications is that the code for each notification type (tile, badge, or toast) follows a similar pattern and set of APIs. Often, the difference between them barely extends beyond a change in the class name. This uniformity in coding patterns will speed your familiarity with these features; if you know how to send a push notification to a tile, then you know how to send a badge or toast push notification as well.

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.

These topics assume that you have a working knowledge of tile and notification concepts and terminology. For more information, see the overviews under Tiles, badges, and notifications.

Most of the code in these topics is taken from full, downloadable, Windows samples. To see the code in place and change and exercise it yourself, visit Windows Store app samples and help yourself.

In this section

Topic Description

Using NotificationsExtensions

The NotificationsExtensions object model library allows you to supply tile, badge, and toast notification XML template contents without using the XML Document Object Model (DOM). It gives you a simpler, clearer, and more direct method of supplying notification content.

Creating tiles and badges

This section shows you how to define tile or badge content and send that content as a notification. The content uses local notifications, which are the simplest notifications to implement. Once you understand the basics of tiles and badges, you can apply that knowledge to sending notifications through the other delivery methods: scheduled, periodic, and push.

Pinning secondary tiles

This section shows you how to use secondary tiles, which enable a user to pin specific content or experiences from an app to the Start screen so that they have direct access to that content or experience.

Sending toast notifications

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.

Delivering notifications

Examples given in the Creating tiles and badges and Sending toast notifications sections demonstrate the use of local notifications. Local notifications allow you to update your tiles and badges and send toast notifications while your app is running, using text and image resources stored on the device that the app is running on. This section extends that information to discuss the other mechanisms available for you to provide tile, badge, and toast content: scheduled, periodic, and push notifications.

Troubleshooting tile, toast, and badge notifications

This topic discusses initial troubleshooting steps you should take when you encounter problems with tile, toast, and badge notifications, including the various notification methods: local, push, periodic, and scheduled notifications.