Adding interaction to a notification
What makes notifications so powerful is that they don't represent just a passive piece of information. The user can interact with them to perform actions without having to open the application. Let's explore the various ways a user can interact with a notification.
The most basic interaction is clicking on the notification, which is also the most common scenario. For example, users get a notification that they have received a new mail and when they click on it, they expect the mail client to open up so that they can read it.
This scenario can be accomplished thanks to the AddArgument()
method, which you can use to pass a key /value pair that you can retrieve when the application is activated from a notification. Let's see the following example:
private void SendNotification() { new ToastContentBuilder() .AddText("New message") .AddText("...