Reputation: 857
I'm trying to display a simple toast, it showed the first the I deployed the app but it doesn't show anymore. I didn't change anything to the code between deployments. It's the basic blank project, except in Mainpage this is the only code
public MainPage()
{
this.InitializeComponent();
}
public static void Notification(string title, string content)
{
// Construct the visuals of the toast
ToastVisual visual = new ToastVisual()
{
TitleText = new ToastText()
{
Text = title
},
BodyTextLine1 = new ToastText()
{
Text = content,
},
};
ToastContent toastContent = new ToastContent()
{
Visual = visual,
};
// And create the toast notification
Windows.Data.Xml.Dom.XmlDocument doc = toastContent.GetXml();
var toast = new ToastNotification(toastContent.GetXml());
ToastNotificationManager.CreateToastNotifier().Show(toast);
}
private void buttonShowToast_Tapped(object sender, TappedRoutedEventArgs e)
{
Notification("a", "b");
}
NuGet package installed: NotificationExtensions.Win10 (version: 14332.0.2)
This is as simple as it could be, why is it not working? Am I missing some sort of permission?
Upvotes: 3
Views: 4190
Reputation: 857
I figured it out. For some reason Windows 10 disabled the notifications for all apps deployed with Visual Studio. Heading over to "Notifications & Actions" in the settings of the device the permissions were toggled off under "Get notifications from these senders".
Toggling the permissions to "On" for the app solved the issue.
Upvotes: 5