Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Windows 8 Store app WinRT local toast notification not showing

I have the following code to show a toast notification locally in a C# / XAML Windows Store app:

private static void ShowToast(string message)
{
   var toastXmlString = string.Format("<toast><visual version='1'><binding template='ToastText01'><text id='1'>{0}</text></binding></visual></toast>", message);
   var xmlDoc = new Windows.Data.Xml.Dom.XmlDocument();
   xmlDoc.LoadXml(toastXmlString);
   var toast = new ToastNotification(xmlDoc);
   ToastNotificationManager.CreateToastNotifier().Show(toast);
}

The toast is never shown in the UI. You can try it with an empty default VS 2012 Windows Store app project and this code. Is there something that needs to be configured first?

like image 696
Rene Schulte Avatar asked Oct 10 '12 18:10

Rene Schulte


2 Answers

Make sure that you have "toast capable" set in the manifest.

like image 129
mbrit Avatar answered Dec 28 '22 07:12

mbrit


hey and also make sure that you don't test your app in simulator mode (you need to use the Local Machine mode)! it took me 20 minutes to figure that one out....

like image 39
Damien Avatar answered Dec 28 '22 08:12

Damien