Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use Windows 8 toast notification from desktop app

I developed a desktop app, which is a simple .exe for Windows.

It works fine on Windows 8.

I try now to use "toast notification" to show some alert for user.

So I trained with Microsoft sample, available here: http://code.msdn.microsoft.com/windowsdesktop/sending-toast-notifications-71e230a2/

It works fine, but I have to create a shortcut to my app to use toast notification.

I tried to remove shortcut creation, but it doesn't work. And I understand, because for desktop app, shortcut is a prerequesite for toast notification, as you can read on Microsoft website: http://msdn.microsoft.com/en-us/library/windows/apps/hh802768.aspx

My question is simple. If user decide to delete shortcut (which is a .lnk in his profile folder), how can make my toast notification work without this shortcut ?

I don't want to create shortcut every time on runtime if it's not created, because user decided to delete it, and create it every time is not correct.

So, is there any way to use toast notification from desktop app without shortcut ?

like image 633
TheFrancisOne Avatar asked Nov 13 '22 15:11

TheFrancisOne


1 Answers

The documentation you quoted seems pretty clear:

A shortcut to your app, with a System.AppUserModel.ID, must be installed to the Start screen. Note, however, that it does not need to be pinned to the Start screen. For more information, see How to enable desktop toast notifications through an AppUserModelID.

Note there's a distinction between "pinned" and "installed", if you can install without pinning (unsure if you can) it would be less likely user would find and delete it.

That said, there's never any guarantee the shortcut will be there. Perhaps your app on launch (or whenever) could detect that the shortcut is gone and "gently" inform the user that their app experience will be less than optimal, then offer to reinstate the shortcut (which you'd do programmatically).

Keep in mind the user can always turn off notifications on an app by app basis or system-wide anyway, so removing the shortcut is only one of the ways the end user might not see your notifications.

like image 78
Jim O'Neil Avatar answered Nov 15 '22 04:11

Jim O'Neil