Compartir a través de


CONTENT MOVED: Quickstart: Sending a local toast notification and handling activations (Windows 10)

Content moved

Please see the article on docs.microsoft.com for the latest documentation.

Comments

  • Anonymous
    August 05, 2015
    I have a Windows 8.1 Universal app. I assume this will only work if the app is running on Windows 10. But will it cause issues if the app runs on Windows 8.1?

  • Anonymous
    August 12, 2015
    @pkz Thanks for the question! If you are wondering if the new Windows 10 UWP app can run on Windows 8.1 platform, the answer is no unfortunately. If you are wondering if you can use the adaptive toast templates in a Windows 8.1 app running on Windows 10 OS, the answer is partially - you can use the adaptive templates (flexible visuals), but only part of the interactive features - you can do protocol launch, but not foreground activation or background activation since Windows 8.1 SDK doesn't have the new activation kind and the new background trigger.

  • Anonymous
    August 19, 2015
    I have a windows 8 app, notifications enabled for my app. and its working great in windows 8 and windows 8.1 and Windows 10 machines. The only problem i am facing is when user taps on toast notification based on the launch arguments (which are present in toast can be read from LaunchActivatedEventArgs of Onlaunched event) I am redirecting the user to specific page. This functionality is working fine in Windows 8,8.1 machines but not working in windows 10 machine. Could you please suggest me what should i do ?

  • Anonymous
    August 24, 2015
    @Suresh - See our conversation on the Adaptive and Interactive Toasts documentation article

  • Anonymous
    August 27, 2015
    @andrewbares7 - sorry for the late reply and thanks for pointing me. am going to see those comments now.

  • Anonymous
    September 02, 2015
    Hi! You say "Note: the only thing your app wouldn’t be notified for, is a local toast being popped/added, since it is not necessary to notify your app client about something it just did.". That makes sense, but what about Scheduled Toast Notifications? Is there any way to be notified when a scheduled toast I issued fires?

  • Anonymous
    September 03, 2015
    @Pawa - even for scheduled toasts, that's something your local app knows about, so we choose not to tell you about something your app already knows about. What scenario are you trying to accomplish with this?

  • Anonymous
    September 04, 2015
    @andrewbares7 - Thanks for your reply! I am doing it in foreground, but I couldn't find a way to do it in background. I have since solved my issue in another way, though. I'm developing an app for repetitive reminders, like "take a break every hour". I wanted to know in background when a notification is delivered so I could clear previous notifications and avoid a pile-up in the action bar. I have since discovered that by giving each notification the same Group and Tag effectively causes them to replace each other, which solves my issue. I can still compare them by storing unique Ids, so for my purpose everything is working.

  • Anonymous
    September 04, 2015
    @Pawa - Ah yes, Group and Tag sounds like the correct way to make that scenario work! Glad to hear you got it working! Note that you also can set the ExpirationTime on your toasts, so that they automatically disappear after a certain amount of time. Useful if a toast is no longer relevant after a certain point in time.

  • Anonymous
    October 11, 2015
    Hello @leixu2046 and @andrewbares7. Can I send Toast Notifications from Win32 application? Since I didn't find any Win32 API for Toast Notifications, but I want to implement it with C++ in my Win32 application.Thank you.

  • Anonymous
    October 13, 2015
    @Shenghua - Lei is working on publishing a post explaining how to send toasts from Win32. He'll hopefully have that post up by the end of this week.

  • Anonymous
    October 16, 2015
    @ShenghuaChen Hi Shenghua, check out this blog post on how win32 apps sends and handles toast notifications: blogs.msdn.com/.../quickstart-handling-toast-activations-from-win32-apps-in-windows-10.aspx

  • Anonymous
    October 19, 2015
    Really thank you @andrewbares7 and @leixu2046, it's very helpful to me.

  • Anonymous
    November 23, 2015
    The comment has been removed

  • Anonymous
    November 23, 2015
    The comment has been removed

  • Anonymous
    January 06, 2016
    These are 2 examples of samples using toast notifications and tile notifications: code.msdn.microsoft.com/Tile-notifications-in-e217d57f code.msdn.microsoft.com/Toast-notifications-in-17c55610 Best of luck!

  • Anonymous
    March 24, 2016
    Can't clip this code or in some cases even read it. Is it formated for Edge?

    • Anonymous
      April 14, 2016
      Hey Rick, sorry for the issues with the code snippets. MSDN Blogs migrated to WordPress recently, and it seemed to have messed up a few things. I've fixed the code snippets, they should display and copy correctly now!
  • Anonymous
    March 31, 2016
    Can background task works with Desktop application too? I am not planning to have my application available on app store or not creating a universal windows type of project. This is regular console or desktop application and will be closed after notification is generated, How can I implement chasing the actions?

  • Anonymous
    April 08, 2016
    I have an Existing WinRT 8.1 App. All Toast Notifications works beautifully on Win8.1 OS.No when I tried to run the same 8.1 app on Win10 OS, I don't see any notifications. Do I need to do something extra?Note: Action center is enabled and I have not restricted any App specific notifications in notification Center.

    • Anonymous
      April 14, 2016
      Hey Ramkiran, 8.1 apps should work fine on 10. Could you give us more info? (1) Desktop or Mobile? (2) What build are you running? Type "winver" in Start. (3) What's your app's name? Can we install it from the Store and try it out? (4) Are you using push notifications, or local notifications? (5) Which toast template are you using? ToastText01, etc...
      • Anonymous
        April 20, 2016
      1. It is a Win8.1 Phone App running on Win10 OS Device.2. version is 1511 and Build is 10586.17.3. No you cannot download from Store.4. These are Local Notifications.5. ToastTemplateType.ToastText01 More Information below - This doesn't work with Assigned Access - Associate Persona. It works with Admin Persona.It has something to do with ToastCapable="true" property in Manifest file. Below are my observations.... 1) First Time run ever with Toast Capable to true - No Toasts 2) Seconds time run without Toast capability - Displayed Toasts. 3) Third time run back with Toast Capable to true - Displayed Toasts.->> Not sure why its behaving strange though.
        • Anonymous
          May 03, 2016
          Hmm, well you definitely need to have ToastCapable set to true in the manifest since 8.1 required that, otherwise your toasts won't work in 8.1 (in 10, we stopped requiring the ToastCapable flag).I'll see if I can repro the issue, but just FYI, we haven't heard any other reports of toasts not working for 8.1 RT phone apps running on 10.
          • Anonymous
            October 12, 2016
            I got it working with adding AUMID to the toast capable apps in Lockdown file.
  • Anonymous
    June 28, 2016
    Hi everybody!Why there is no "ExpirationTime" attribute for the ScheduledToastNotification, In MSDN it says it has, in VS2015 Update 3 it says no. Can't figure it out.

    • Anonymous
      December 06, 2016
      Hey Hamza, sorry for the extremely slow response. ScheduledToastNotification unfortunately is missing the ExpirationTime property as you noticed. Thank you for letting us know that you would use this property, that helps us prioritize for future releases!We've updated the MSDN documentation that incorrectly claimed ScheduledToastNotification supported expiration time. Thanks!
  • Anonymous
    August 09, 2016
    Is there a way to subscribe to all toast notifications? Specifically, if there is a commercial app running that pops toast for certain events, and I wish to write a service that waits for specific notifications from that app, which then performs a function based on the content of the notification, is that a supported scenario?

  • Anonymous
    August 28, 2016
    Is there a way to show Windows 8.x notifications on Windows 8.x, but show interactive ones on Windows 10? Currently, I am using custom template, and on Windows 8.x it does not show up at all. I want to be able to detect that and show Windows 8.x notification instead.

  • Anonymous
    January 09, 2017
    Is there any way to notify my app for local toast?

  • Anonymous
    February 08, 2017
    I have a UWP app I am developing, I pop up toasts from a background task on a specified interval, this works perfectly.However when I click the toast my App loads up but never gets past the loading screen. I worked out that I need to handle the OnActivated override which I have done but if I breakpoint inside this event it is never triggered and my app never gets beyond the loading screen. Is there some reason this even would not trigger? The notification was created in c# using the community toolkit:Microsoft.Toolkit.Uwp.Notifications

    • Anonymous
      February 08, 2017
      Can you please share your Windows version information, and possibly a code snippet of how you construct your toast? Please feel free to reach out at lex@microsoft.com and we will be able to help further.
      • Anonymous
        February 09, 2017
        Hi, sorry this was me being a bit of an idiot, I finally realised what was going on after an hour or two of flapping.As I was opening the app from a Toast which was created in a background task the App was not actually being debugged in Visual Studio which obviously meant that the OnActivated break point as not being hit. So I went ahead and actually added the code and low and behold it worked.So mostly a schoolboy error! Out of interest, is there any way to attach a debugger to an App on launch like that? I have done it while a program is running but not automatically on launch. Its not something I have ever had to do before...
  • Anonymous
    April 10, 2017
    The comment has been removed

    • Anonymous
      April 19, 2017
      The comment has been removed
  • Anonymous
    April 27, 2017
    I wanted to send a toast notification from a C# program with out using a UWP app. It took a lot of research. I am newish to C# and I have found a solution. https://pastebin.com/QrYa47Qu

  • Anonymous
    April 30, 2017
    I just tried this API and it works very poorly. There's bugs when I run this in embedded mode.