Search code examples
node.jsnotificationselectrontoastwindows-10-desktop

Windows 10 Toast Notification with scenario set to "incomingCall" messes up the notification UI


I am working on an Electron app which uses NodeRT to show toast notifications in Windows 10. So far, I have got things working and a "ToastGeneric" notification shows up fine.

The app is expected to show a notification to the user when the app gets an incoming call.

A regular toast shows up fine:

Regular Toast

However, if I add a scenario="incomingCall" to the <toast>, it messes up the UI.

Toast as incomingCall

I could not find any proper documentation on this behavior anywhere. I even tried using a code sample given by Microsoft, but that does not work either.

Any idea where is this going wrong?

Here is my toast payload:

<toast>
    <visual>
        <binding template='ToastGeneric'>
            <text>%s</text>
            <text>%s, %s</text>
            <group>
            <subgroup>
                <text hint-style="base">52 attendees</text>
                <text hint-style="captionSubtle">23 minute drive</text>
            </subgroup>
            <subgroup>
                <text hint-style="captionSubtle" hint-align="right">1 Microsoft Way</text>
                <text hint-style="captionSubtle" hint-align="right">Bellevue, WA 98008</text>
            </subgroup>
            </group>
        </binding>
    </visual>
    <actions>
        <action arguments = 'answer'
                content = 'answer' />
        <action arguments = 'ignore'
                content = 'ignore' />
    </actions>
</toast>

Solution

  • Based on the suggestion provided by @Richard Zhang, I tried out the template in Notifications Visualizer.

    It produced the same messed up UI that I see happening through NodeRT. It seems that the incomingCall scenario mandatorily requires the template to provide the two (or three, I don't remember exactly) buttons right after the body. And then a final row with Answer and Decline button.

    It would have been really cool to be able to use that scenario, however, I had to go with the regular toast notification.