Search code examples
xmlwinapinotificationstoast

App notification (Toast) breaks when adding image


I can send Toast notifications with buttons just fine, but when I add an image it seems to balk and just put up a generic "New Notification" box without the text, buttons or image.

The xml looks like:

<toast><visual><binding template='ToastGeneric'><text>My Main Line Notification</text><text>My additional line of details.</text><image placement='appLogoOverride' hint-crop='circle' src='ms-appdata:///local/info48x48.png'/></binding></visual><actions><action content="Button1" arguments="0" /><action content="Button2" arguments="1" /></actions></toast>

I copied a .png file named info48x48.png to several locations to try:

%APPDATA%\..\local\NameOfExeWithoutExtension
%APPDATA%\..\local\NameOfShortutThatShowsInTitle
%APPDATA%\..\local\AppId.The.One.With.Dots
%APPDATA%\..\local\packages\AppId.The.One.With.Dots

but alas, it doesn't like something about the XML above. This works (removed image):

<toast><visual><binding template='ToastGeneric'><text>My Main Line Notification</text><text>My additional line of details.</text></binding></visual><actions><action content="Button1" arguments="0" /><action content="Button2" arguments="1" /></actions></toast>
  1. Any ideas what has gone wrong
  2. Does the XML look correct for the image?
  3. Where exactly does ms-appdata:///local/ point to?

TIA!!


Solution

  • Thankfully, it turns out you can use the file scheme:

    file:///C:/Path/To/Your/Image.png"