Jimmy Engström

NAVIGATION

Universal apps and NotificationsExtensions - Toasts (Part 3)

Here is how to handle toasts the easy way in Universal apps.

First add the “NotificationsExtensions.UniversalApps” Nuget package.

See blog post showing how.

Toast templates:
http://msdn.microsoft.com/en-us/library/windows/apps/hh761494.aspx

It is possible to send any toast template to Windows Phone 8.1 but it will always be shown as an modified version of ToastText02.

You can add a Toast notification like this:

IToastText02 toastContent = ToastContentFactory.CreateToastText02();
toastContent.TextHeading.Text = "Tosty!";
toastContent.TextBodyWrap.Text = "Toasts, best invention since.. ehmm toast";

ScheduledToastNotification toast;
toast = new ScheduledToastNotification(toastContent.GetXml(), DateTime.Now.AddSeconds(10));
toast.Id = "SomeID";
ToastNotificationManager.CreateToastNotifier().AddToSchedule(toast);

Posted in Windows Phone