user1122052
user1122052

Reputation: 341

Why is Toast notification using OnLaunched instead of OnActivated in windows 10 app?

When clicking on my Toast notification the OnLaunched method is being called instead of the OnActivated. And nothing is in the e.Arguments - any ideas?

My Toast template is the default Visual Studio Server Explorer template:

<?xml version="1.0" encoding="utf-8"?>
<toast>
  <visual>
    <binding template="ToastText01">
      <text id="1">Test message</text>
    </binding>
  </visual>
</toast>

Upvotes: 0

Views: 519

Answers (2)

user1122052
user1122052

Reputation: 341

It was so silly, so the default test toast created in Visual Studio has the template set as "ToastText01" but it should be "ToastGeneric"

<?xml version="1.0" encoding="utf-8"?>
<toast>
  <visual>
    <binding template="ToastGeneric">
      <text id="1">Test message</text>
    </binding>
  </visual>
</toast>

Upvotes: 1

A. Milto
A. Milto

Reputation: 2383

OnLaunched is called because the legacy toast template is used:

Note: If you are using the legacy toast templates from Windows 8.1, OnLaunched will be called instead. [docs]

And e.Arguments is empty because the launch attribute of the toast is not set in XML (see this MSDN page for details).

Upvotes: 1

Related Questions