I am trying to make a toast notification show in a Xamarin Forms, windows phone 8.1 silverlight project. Inside the Windows Phone project I have a method that creates a toast notification, however, nothing happens when it is executed. No error is thrown everything seems to execute correctly but nothing happens on the phone.
I have tested it on an emulator and an actual cell phone. Everything I have found online until now is practically the same as what I have (with slight differences, but nothing that should make a difference).
The code in the method is the following:
private void CreateNotification(string title, string message)
{
ToastNotifier toastNotifier = ToastNotificationManager.CreateToastNotifier();
XmlDocument toastXml = ToastNotificationManager.GetTemplateContent(ToastTemplateType.ToastText02);
XmlNodeList toastTextElements = toastXml.GetElementsByTagName("text");
toastTextElements[0].AppendChild(toastXml.CreateTextNode(title));
toastTextElements[1].AppendChild(toastXml.CreateTextNode(message));
ToastNotification toast = new ToastNotification(toastXml);
toast.ExpirationTime = DateTimeOffset.UtcNow.AddSeconds(5);
toastNotifier.Show(toast);
}
Any help would be greatly appreciated.
Thanks in advance!