Below method executes on call for set Toast, but doesnot display any Toast after time elasped. Is any more setting required for Windows 8 Metro app Toast notification
int scheduledToastCounter = 1;
public void Set_Future_Toast()
{
XmlDocument toastXml = ToastNotificationManager.GetTemplateContent(ToastTemplateType.ToastText02);
XmlNodeList stringElements = toastXml.GetElementsByTagName("text");
stringElements.Item(0).AppendChild(toastXml.CreateTextNode("Scheduled Toast"));
DateTimeOffset displayTime = DateTimeOffset.UtcNow.AddSeconds(3);
ScheduledToastNotification scheduledToast = new ScheduledToastNotification(toastXml, displayTime);
scheduledToast.Id = "Future_" + this.scheduledToastCounter++;
ToastNotifier notifier = ToastNotificationManager.CreateToastNotifier();
notifier.AddToSchedule(scheduledToast);
int scheduledToastCount = notifier.GetScheduledToastNotifications().Count;
}
}
Have you tried to make the application Toast Capable? check this thread: Toast notification isn't working?
You can change directly your Package.appxmanifest from code page :
add ToastCapable to the VisualElements Tag
Some times the screen of the Package.appxmanifest dosen't have the option to change it:
You should set toast capable to yes in app package.
Be sure that you checked the box in the App's config file to enable Notifications.
An interesting issue I ran into is I was using toast with images. I had the images in a dependent assembly with copy to output directory. Scheduling toast just failed silently. Ondemand toast failed with an HRESULT of E_FAIL (no other information). When I finally copied the images into the main project (with copy to output directory) then they started working.
Need set small icon for notifications!!!