CONTENT MOVED: Adaptive and interactive toast notifications for Windows 10
Content moved
Please see the article on docs.microsoft.com for the latest documentation.
Comments
Anonymous
July 04, 2015
Will there be a nuget library to facilitate these notifications? similar to the NotificationsExtensions package.Anonymous
July 27, 2015
How can I call an xml file for a custom Toast by code?Anonymous
August 03, 2015
@FullMetal99012 (Editor update) Yes! NotificationsExtensions for Windows 10 is available and officially supported by Microsoft! (Original comment) You can use github.com/.../InteractiveToastExtensionsAnonymous
August 07, 2015
@Fullmetal99012 As Cabuxa's comment mentioned, the official NotificationsExtensions for Windows 10 is now available through NuGet or GitHub. @Anrafu13 if you are also asking about extension library, please see if you may find the post below yours helpful. If you are asking about loading an existing xml file from your appx package, then please take a look at msdn.microsoft.com/.../windows.storage.storagefile.getfilefromapplicationuriasync.ASPXAnonymous
August 08, 2015
I'm trying to get the audio element with ms-appdata:/// to run under Windows 10 UWP (Desktop) but no luck so far. Tried the temp and the local folder. Has this feature made it into the release build? Is there a limit to the allowed length of the audio? Are there any special requirements with regards to the uri that don't exist with a MediaElement? Best regards, Harald www.carecom.de
In Windows 10 UWP apps, the <audio> element remains unchanged compared to what’s currently supported for Windows Phone 8.1. You can now also provide a path to a local audio file in your app package or app storage, to play a custom sound specific for your app: ◾ms-appx:/// ◾ms-appdata:///
Anonymous
August 11, 2015
@Harald - Looks like you're right, custom audio isn't working. We're investigating this issue. As of now, both ms-appx and ms-appdata don't work on Desktop, and only ms-appdata works on Mobile. Thanks for reporting this!Anonymous
August 11, 2015
I am using the adaptive toast with a Win32 app, and I cannot manage to get my toast to stay in the action center when it timed out. If i close it with the close button, it goes in the action center but when let it time out, it just disappear. With the same toast (i used your first sample) in an Universal app, the toast stay in the action center when it timed out. Is it the expected behaviour for the win32 app ?Anonymous
August 12, 2015
@Keuvain Thanks for trying the new toast features. The default behavior for win32 apps should be the same in which the toast notifications are persisted in action center. We will investigate in the false behavior you are observing currently. Also, we will have some guidance and sample published soon on how to handle application activation from toast once it's inside action center using COM activation.Anonymous
August 16, 2015
How do you get a larger inline image like the reminder example? I am unable to get anything other than a small cropped image like the first example. I'm sending the toast from a desktop program if that makes a difference.Anonymous
August 17, 2015
@Adrian - For an inline image to display full width, the scenario attribute on the <toast> element needs to be set to either "reminder", "alarm", or "incomingCall". <toast scenario="reminder">
....
</toast> However, do realize that the scenario changes other things. Those three scenarios will all force the notification to stay on screen until the user does something with it. Don't pick a scenario that conflicts with what your user expects (for example if a new text message used the reminder scenario, users would be annoyed that they're forced to dismiss the text message to continue doing anything on their device).Anonymous
August 17, 2015
Hi, when i am trying to open the Background task from the action button in toast, but i am getting an compilation error "the type or namespace "NotificationActionTriggerDetails" could not be found". Am i doing it in the right way. please help.Anonymous
August 19, 2015
I am running my windows 8 app in windows 10 machine. the problem i am facing is i am unable to get the LaunchActivatedEventArgs in launch event ? can anyone suggest the issue please ?Anonymous
August 19, 2015
Sorry for not providing full information for the above question. Windows 8 store app in windows 10 machine and the question is regarding the ToastNotification. when user taps on it.Anonymous
August 20, 2015
One problem I'm seeing is that my notifications sometimes don't show up in the UI, but rather are sent to the Action Center. How can we avoid this and always show the Toast UI?? For example, I'd like to alert the user to the fact that a refresh has completed in my app via a toast notificationAnonymous
August 20, 2015
how I load xml file to XmlDocument?Anonymous
August 20, 2015
@Amer: stackoverflow.com/.../895305Anonymous
August 20, 2015
Is anyone facing the problem which i am facing ? please see the previous 5 comment from this comment.Anonymous
August 21, 2015
@Suresh - Ah I see you did comment over here originally, great! Ok, so Windows 8 app running on Windows 10 no longer receives the LaunchActivatedEventArgs inside OnLaunched for toasts... That definitely sounds like a bug. Probably due to the fact that we've switched to using OnActivated as documented in this blog post... but Windows 8 apps SHOULD be grandfathered in... We'll investigate it. Thank you for reporting it! @Brandon - Toasts should always show up on-screen first before going into action center, unless the user changed their settings and disabled banners. You can check your settings on your PC by opening Settings -> System -> Notifications & Actions, and then clicking on your app, and confirming that "Show notification banners" is enabled. If it's enabled and toasts are still inconsistently appearing, please give us more info (sample app if you have one) and we can investigate further. @Amer - Even better, use the new NotificationsExtensions library so you don't have to generate XML! You can use IntelliSense and objects to create your notifications! blogs.msdn.com/.../introducing-notificationsextensions-for-windows-10.aspx Alternatively, to load a string to XmlDocument, create a new XmlDocument, and then call .LoadXml(string);Anonymous
August 22, 2015
Has the issue with custom sound been fixed? And how will the fix be rolled out to users, via a regular Windows Update or in a new Windows 10 "build" update? Is it possible to have a notification play a long sound file (30 seconds to 1 minute)? I remember it wasn't possible in W(P) 8.1. I wanted to test it in a UWP app, but it didn't work and I found out in the comments here that there's a bug.Anonymous
August 23, 2015
There is an error in the sample code: it's not NotificationActionTriggerDetails, it's ToastNotificationActionTriggerDetail.Anonymous
August 24, 2015
@Suresh - I just tested a Windows 8.1 app on Windows 10 and the OnLaunched got triggered correctly, with the toast launch args. You're still having issues with that? @Abdusamad - Custom audio... We incorrectly thought that we supported custom audio on Desktop. Turns out that was cut, so audio has remained unchanged from Windows 8.1 (only mobile supports ms-appx and ms-appdata). However, there's new bugs affecting the mobile custom audio (ms-appx doesn't work, and also on "alarm" or "incomingCall" scenarios, neither ms-appdata nor ms-appx work). We're still working on fixing them, no update yet. @opayen - Thanks for pointing that out!! Updated the code snippet.Anonymous
August 24, 2015
Thank you for the replie(s on your blog). That's too bad. I have an app in the Windows Phone 8.1 store with almost 700 downloads and lots of users requesting a custom long notification sound (non looping). I'm in the process of porting the app to UWP Desktop/Tablet and Mobile and I'm a bit disappointed it still hasn't been implemented on the Windows platform. I hope it will be implemented soon because I think there's lots of developers and users who'd like that feature and it's basically the #1 requested feature for my app. Any news on the Tile Template Visualizer btw? Thanks again.Anonymous
August 26, 2015
What's the longest audio file you've tried? And on the toast, you set duration="long"? Tile Template Visualizer is still pending approval to use the actual DLL from Start (otherwise it won't be 100% exact, only a visualization).Anonymous
August 27, 2015
The longest was 3:20. Duration="long" works doesn't work on WP 8.1. And on UWP I can't test with custom sound because it's buggy/not implemented yet, so that's my dilemma. Is there a different way to set source for custom sound other than ms-appx or ms-appdata? Thanks for the update. :)Anonymous
August 27, 2015
ms-appdata works on Windows 10 Mobile, as long as you're not also using it while specifying "incomingCall" or "alarm". So you could try that. So you theoretically should be able to achieve it right now, assuming duration="long" works on Mobile now? I haven't tried that, as Lei's article says, we really were only keeping the "long" option around for app compat, so it's possible we didn't bring it to mobile.Anonymous
August 27, 2015
@andrewbares7 - sorry for the late reply. And thanks for answering. I have done a small mistake too. i solved the problem my self. Like in the blog he said toast launch args will be received in OnActivatedEvent i did the same in my app and we need to update the toast payload(toast xml) too. This toast payload will not work in windows 8 machine. it only works in windows 10 machines. In windows 10 machine toast notifications will be received even though the app in running in the foreground. thanks once again for this good blog.Anonymous
September 01, 2015
@suresh thanks a lot for trying these new features out, and yes, the new toast payload does not work in Windows 8 machine since the old parser wouldn't recognize the new stuff we came up with. Apologize for missing your previous questions but I'm glad Andrew helped out. Please do reach out if you have more questions.Anonymous
September 02, 2015
@leixu2046 "The default behavior for win32 apps should be the same in which the toast notifications are persisted in action center." I've implemented usage of new toast notifications in Telegram Desktop messaging app and the notifications disappear from Action Center as soon as they disappear from screen (or as soon as the action center is closed, if it was opened while the notification was still on the screen). It is a bad behavior and many users have complained about this. May I have any information about that issue? Was it reproduced in MS? Will it be fixed by a Windows Update, or it will persist that way much longer? I'm interested in any information about that.Anonymous
September 06, 2015
Also I've got some problems with per-app notification settings, there are no apps listed, but I use one my own custom app with notifications and one downloaded from the Store, both sending notifications, which could be seen here: updates.tdesktop.com/.../noapps.png How can I get my win32 app to that list? Why I don't have any apps there and how this could be fixed?Anonymous
September 06, 2015
Where can I find a list of the protocols that can be launched? specifically I'd like to launch the default browser to an url, but arguments="http://www.slashdot.com" doesn't work.Anonymous
September 07, 2015
@John - I've told Lei to follow up with you. @Lindsay - The available URI launch protocols can be seen here: msdn.microsoft.com/.../mt228340.aspx They're the same that are supported with LaunchUriAsync. Launching websites works, just tested it on my personal RTM laptop. Make sure that you're setting activationType="protocol". Tell us what's happening and maybe we can help you. For example, the following payload generates a toast with a button that, when clicked, opens Slashdot. <toast> <visual> <binding template='ToastGeneric'> <text>HTTP Toast</text> </binding> </visual> <actions> <action activationType="protocol" arguments="http://www.slashdot.com" content="Open SlashDot"/> </actions> </toast>Anonymous
October 03, 2015
How do I send a toast notification that works on both Windows 10 and Windows/WP 8.1? I've tried adding two <visual> elements, but this leads to Win10 just displaying "New notification" and not any of the actual notification content. If I send just the 8.1 or just the Win10 <visual> it works. But I need to send both because users may be using a mix of devices (especially Win10 PCs with 8.1 phones since Win10 Mobile isn't out yet).Anonymous
October 05, 2015
There is ToastNotification.Activated event which provides ToastActivatedEventArgs and it does not contains UserInput property while Application.OnActivated event provides ToastNotificationActivatedEventArgs which contains UserInput property. Why windows is losing information in ToastNotificationActivated event? Is there a way i can get the UserInput property in ToastNotification.Activated event?Anonymous
October 05, 2015
@Half baked toast - Is there a reason you're using the Activated event on the toast object instead of the OnActivated method? Please tell us your scenario so you can help. If the user taps on your toast from within action center, that Activated event will NOT fire. We recommend using the OnActivated method, since the Activated event isn't useful for most scenarios. For example, what happens when the user clicks on your toast after they've closed your app? The Activated event won't be able to trigger. But OnActivated method does.Anonymous
October 05, 2015
@andrewbares7 - I'm raising the toast notification from a dll and want to handle the toast events in that dll only. The application is not a UWP app and I don't want any event if the application is closed. Since there is no Application class so I don't have the Application.OnActivated method. When the ToastNotification.Activated event can handle the most of the scenarios of toast notification like button click on notification, cancel and timeout, why UserInput is not available in that event?Anonymous
October 08, 2015
@Brandon - Unfortunately there's no good solution for sending a single payload that supports both 8.1 and the new features of 10. You would have to store on your server what OS the device is on, and then send the correct payload. @Half baked - I've told Lei to follow up with you about Win32 apps. He's working on a blog post that covers this.Anonymous
October 15, 2015
I am using the a win32 app, and I cannot manage to get my toast to stay in the action center when it timed out. With the same toast in an Universal app, the toast stay in the action center when it timed out. Is it the expected behaviour ? Also - how to handle application activation from toast once it's inside action center?Anonymous
October 16, 2015
defaultSelection or defaultInput... ? I think defaultInput is righ, not defaultSelectionAnonymous
October 16, 2015
The comment has been removedAnonymous
October 16, 2015
@Dat Nguyen - Thanks for reporting that mistake! You're correct, it should be defaultInput. I've updated the article.Anonymous
October 20, 2015
@andrewbares7 - Is there any update on ms-appx support for custom audio? Or custom audio for Desktop? I've implemented custom audio for Windows 10 Mobile using ms-appdata, but it doesn't work on my Lumia 520 with Insider Preview. I have a method (in app.xaml.cs) that fires after first install or an update, which copies the sound file to the appdata folder so I can use it for custom audio, but when I launch the app the first time, it gets to the splashscreen and closes. So I think something goes wrong when copying the file. I haven't been able to reproduce this on the emulators, it works fine there. I dont know if it's a Insider Preview issue or what. Still trying to figure it out. Being able to use ms-appx would be a lot more efficient, since I won't have to copy the file.Anonymous
October 21, 2015
@Abdusamad - ms-appx for mobile should be fixed in the latest mobile preview. I'll test it tomorrow on internal builds. You can assume that it'll work in the final release of mobile. Desktop custom audio is not being added at this time.- Anonymous
July 14, 2016
Hi,Can't use ms-appx and ms-appdata to set source for ToastAudio on Desktop. I see it's an old trouble.Last comment was almost a year ago. Are there any updates or fixes?
- Anonymous
Anonymous
October 21, 2015
Just tested on Mobile build 10572, ms-appx works. :) Thanks.Anonymous
October 22, 2015
@leixu2046 "The default behavior for win32 apps should be the same in which the toast notifications are persisted in action center." Is there any update on this? In win32 app, My Toast notification is vanished from Action center after time out. But I need it to be persisted until user responds to it. is there any workaround for it?Anonymous
October 23, 2015
@Kiran - See our new post on how to send toast notifications from Win32 apps: blogs.msdn.com/.../quickstart-handling-toast-activations-from-win32-apps-in-windows-10.aspx You'll have to set up a COM server, as that article describes, so that your app can be activated from toasts persisted in Action Center. Otherwise, if you didn't have that COM server, and the user closed your app, and then the user clicked the persisted toast, the toast wouldn't do anything (your Activated event that was registered as a callback is no longer active since your code isn't running). Sorry for not replying to your comment. Thanks for nagging us, we're happy to help!Anonymous
November 25, 2015
The comment has been removedAnonymous
November 25, 2015
@Methew - How are you referencing your local images? Are you using ms-appx:/// with three slashes? A copy of the XML you're using, in addition to a screenshot of your Visual Studio project's file structure (specifically showing the path of the image you're referencing) would be helpful. Local images definitely work, we've used them before.Anonymous
December 08, 2015
I am using a win8 app, and I cannot manage to get my toast to stay in the action center when it expired. With the same toast in an Universal app, the toast stay in the action center when it timed out. Is it the expected behaviour ? Also - how to handle application activation from toast once it's inside action center?Anonymous
December 16, 2015
@AYC - Are you actually talking about Win32 apps? If so, then you have to read the documentation for Win32, since this post is about UWP apps. The Win32 documentation is here: blogs.msdn.com/.../quickstart-handling-toast-activations-from-win32-apps-in-windows-10.aspxAnonymous
December 26, 2015
Note: One important step is missing if you want to uses a background task: You need to register the background agent first: BackgroundAccessStatus status = await BackgroundExecutionManager.RequestAccessAsync(); BackgroundTaskBuilder builder = new BackgroundTaskBuilder() { Name = "ToastAgent", TaskEntryPoint = "Task.ToastAgent" }; builder.SetTrigger(new ToastNotificationActionTrigger()); BackgroundTaskRegistration registration = builder.Register();Anonymous
December 29, 2015
Thanks Rudy for that important code snippet of registering the background task, which we forgot! I've moved all this code to the Quickstart and added the registeration step, and simply made this page link to it so there's no redundant information: blogs.msdn.com/.../quickstart-sending-a-local-toast-notification-and-handling-activations-from-it-windows-10.aspxAnonymous
January 06, 2016
this is a sample that works for tile notifications :D code.msdn.microsoft.com/Tile-notifications-in-e217d57fAnonymous
March 14, 2016
I have precisely the same issue as Half baked toast and I totally support his question. @andrewbares7 Are you guys working on that blog post still?Anonymous
March 14, 2016
Hey Elena, you're talking about Win32 apps? We have a blog post for that (blogs.msdn.com/.../quickstart-handling-toast-activations-from-win32-apps-in-windows-10.aspx). There are a number of open issues that Lei is trying to address with Win32. If you're writing a UWP, we explain how to handle activation in this Quickstart: blogs.msdn.com/.../quickstart-sending-a-local-toast-notification-and-handling-activations-from-it-windows-10.aspxAnonymous
March 14, 2016
Hey, Andrew, thanks for your swift reply. Yes, I am talking about Win32 apps. The blog post you gave me unfortunately does not solve my problem. I've already left some comments there as well. Can we find out what are the "open issues" that Lei is trying to address? This would be extremely helpful.- Anonymous
March 23, 2016
I second the comments here about the UserInput missing in ToastActivatedEventArgs . Most of us gets that indeed without the Activate event we won't be able to have persistent notifications working in the notification center but right now in order for us to move slowly to full UWP apps we have to extract and put as much as possible into a DLL with .NET code that is used by the old school app to slowly port the code base. Notifications is a must have these days and really have the UserInput field would already be a good step to have good notifications support. Then of course in the future we can have full persistent notifications with activations that launch the app. The fact that some of us uses .NET in that secondary DLL library is https://github.com/WindowsNotifications/NotificationsExtensions which is pretty good to construct the notifications.https://blogs.msdn.microsoft.com/tiles_and_toasts/2015/10/16/quickstart-handling-toast-activations-from-win32-apps-in-windows-10/ is a good start to have some support of the ActivatedEvent but again there is no sample somewhere ready to test. It would be appreciated to have one.Thanks for the work.
- Anonymous
Anonymous
March 24, 2016
The comment has been removed- Anonymous
April 14, 2016
The comment has been removed- Anonymous
September 26, 2016
It has been fixed at RS1 timeline.Thanks for the thought.
- Anonymous
- Anonymous
Anonymous
March 28, 2016
Our current balloon notification implementation is WPF, and the issue we are observing is that when the user uses Win 10 where they automatically get converted to Toast Notification (OS Controls it) is text is cut for some languages in the desktop environment. If we use the legacy (Win 7) balloon notification in Windows 10, there is no as such character limitation in the balloon pop-up. What is the character limitation for toast in the desktop environment?- Anonymous
April 14, 2016
Hey Vero!There's no specific character limit on toasts, since different devices might be able to display different amounts of text (and also different languages have different character sizes). Also, we're slightly changing how toast notifications look and feel in new versions of Windows 10, which affects how many characters would be displayed.For your scenario, you should make sure that the user can click the toast to read the full content, so that if the content couldn't all fit, when they click the toast, they can see everything.
- Anonymous
Anonymous
March 31, 2016
I am facing two issues with Toast notification with Desktop application on Windows 101) When user does nothing with the toast, it simply disappear without going to the action center (ToastNotification.Dismissed is ToastDismissalReason.TimedOut). It is not sticky, how do I make it work?2) Chasing the notification is also not working, I have Activated event, tapping on the toast notification does not do anything. Consider after generating notification my application will not be running. But I have created a shortcut under Users Start menu Program using AppuserModelID concept, and It is the same AppID used while creating the notification.- Anonymous
April 14, 2016
Hi Rocky, sounds like you're talking about Win32 Desktop apps, not UWP. Please bring your conversation over to the Win32 article: https://blogs.msdn.microsoft.com/tiles_and_toasts/2015/10/16/quickstart-handling-toast-activations-from-win32-apps-in-windows-10/And for (1), toasts are temporary, after a few seconds, they'll go into Action Center.
- Anonymous
Anonymous
April 15, 2016
When the number of notifications in Action Center exceeds 20, I get an extra notification saying "More notifications". If I click on it, my app opens and all the other 20 toasts from Action Center disappear. I wasn't able to find any documentation on this. Can you please tell me if this is expected behavior?Anonymous
April 19, 2016
Is there any XSD file available for the Toast XML schema? It can be used for the XML data binding for my backend.- Anonymous
May 03, 2016
Hey James! No, we haven't published an XSD for the Toast XML schema. If you're using C# on your backend, you could use NotificationsExtensions to generate your notifications rather than using raw XML.
- Anonymous
Anonymous
May 04, 2016
Hello!How to implementation action events in powershell script?- Anonymous
May 04, 2016
Hey Roman, I'm not sure what you mean... Powershell scripts? This article is about Windows 10 UWP apps.- Anonymous
May 05, 2016
I use powershell script to send toast notification and it works, but there is no way to intercept the events and add EventHandler with objects of WinRT classes.
- Anonymous
- Anonymous
Anonymous
July 01, 2016
The MSDN documentation regarding the src attribute of the image element says that among other protocols both the http:// and the https:// protocol are supported. However, when using such an URI (example: src="https://en.wikipedia.org/static/apple-touch/wikipedia.png"), the image is not displayed in the toast. Downloading the same file locally and using the file:///-protocol (like "file:///C:\images\wikipedia.png") works as expected.Is the MSDN documentation outdated regarding the supported protocols? Was the http://- and https:// protocol support dropped from Windows 8(.1) to Windows 10? If so, was this done on purpose? Or is that a bug? Do Windows 10 toasts still support images from foreign http:// or https:// sources?- Anonymous
January 06, 2017
Hey Charly, sorry for the late reply, I think email notifications once again were turned off for some reason :/http:// and https:// images are supported for UWP's. Sounds like maybe you're writing a Win32 app? Win32 apps do not support http images, since they do not have the package manifest like a UWP containing the internet capability. Hence for Win32 apps, you need to download the image and then reference it via file://.Thanks!Andrew
- Anonymous
Anonymous
July 08, 2016
Hi, I got problem on toast activated.I used activated method to show the form but after a few seconds the form is gone and it was not even disposed.How to prevent this on happening?ThanksAnonymous
January 04, 2017
I have a question related to ToastGeneric template "Text" element.Is there a character size limit for each "text" element only 40 , 60 etc.If there is any how to increase this limit ?Please give any pointers or details on this.Thanks Rajesh- Anonymous
January 06, 2017
Hey Rajesh! Nope, there's no limits on the character lengths of elements (nor are there limits on URI's, etc).However, the entire XML payload must be less than 5 KB. Therefore, you'll want to make sure to trim your strings at reasonable lengths. Maybe 500 chars max of text on the toast? Or if you're using multiple text elements, maybe 200 chars per each text element? You'll want to take into consideration other parts of your payload too, like the launch args, buttons, etc... everything adds up, and you'll need to keep it under 5 KB.
- Anonymous
Anonymous
January 26, 2017
Hi!I have a Win32 application and I've noticed that when I tap/click the toast to acknowledge it, the focus doesn't get properly set to my main application (in my toast handler I say MainWindow.Activate() or something similar). I see my application come up, but keyboard focus is not on it. Should i be doing something different?- Anonymous
January 26, 2017
it seems on toast acknowledge ShellExperienceHost.exe gets focus... and it can't be taken away unless a physical mouse click or tap touches another application.- Anonymous
January 26, 2017
Well for what it's worth I've filed a connect bug with a patch file to apply to the github project to reproduce the issue. I'm pretty sure it's a Win10 bug as on 8.1 this same type of behaviour of putting focus on an element after toast click works fine.https://connect.microsoft.com/VisualStudio/feedback/details/3119759/setting-keyboard-focus-on-an-application-after-win-10-toast-acknowledgement-is-broken-by-shellexperiencehost-exe- Anonymous
February 01, 2017
The comment has been removed- Anonymous
October 11, 2017
Digging up threads from the dead here... If anyone is watching this, has the bug that I opened regarding application focus been resolved with the impeding fall creators update?
- Anonymous
- Anonymous
- Anonymous
- Anonymous
Anonymous
April 08, 2017
Hello. I wonder if there is a simpler way to just handle the dismiss eventhandler for a particular notification? I noticied that the regular ToastNotification has that eventhandler, but ScheduledNotifications does not. I am using the UWP Community Toolkit. Thanks.