Toast notifications for background agents for Windows Phone 8

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

A toast notification is displayed at the top of the screen to notify users of an event. When a background agent is running or has completed some work, you can use the ShellToast APIs to notify the user. While the Show()()() method can be called from any application, a toast will not be displayed if the current foreground application is the caller of the Show method.

Toast Properties

A toast is made up of the following properties:

  • Title - A boldface string that displays immediately after the application icon.

  • Content - A non-boldface string that displays immediately after the Title.

  • NavigationUri - The URI to navigate to if the user taps the toast message.

The amount of text that can be displayed depends on the characters used in the toast message and the length of the Title, which is bolded, and Content, which is not bolded. If only a Title is set, then approximately 40 characters can be displayed before being truncated. If only the Content is set, then approximately 47 characters can be displayed. If a toast is split evenly between a Title and the Content, then approximately 41 characters can be displayed. Any text that does not fit on the toast will be truncated. Windows Phone displays a small version of your application icon to the left of Title and Content. While you can define what icon is associated with your application, it is not possible to pass a different icon for a toast notification.