📜 ⬆️ ⬇️

Windows 10 through 10. Issue # 2. Interaction with users through live tiles and notifications



In the last article, we talked about how in three steps you can increase the visibility and frequency of your users installing Windows 10. In this article we will continue the topic of improving user interaction through one of the most favorite features of Windows applications: live tiles and notifications.

If you are already a Windows application developer, you are probably already familiar with the use of live tiles and notifications. If not, then the growing number of Windows 10 users is quite a good motivation to start thinking about their implementation in the application. Below is a description of what we have added in the top ten.

')
New opportunities:


Let's take a look at how to build relationships with users through new notifications and live tiles, so that your application can work as you want.

Sending responsive and interactive notifications


In Windows 10, pop-up notifications can be configured to display text, images, and interactions. Previously, when sending a notification, you selected from a template directory for notifications , which provided limited flexibility in display and did not allow the user to receive input. The sound that plays when a notification appears can also be easily configured. Below is an example of how this works:

<toast> <visual> <binding template="ToastGeneric"> <text>Sample</text> <text>This is a simple toast notification example</text> <image placement="AppLogoOverride" src="oneAlarm.png" /> </binding> </visual> <actions> <action content="check" arguments="check" imageUri="check.png" /> <action content="cancel" arguments="cancel" /> </actions> <audio src="ms-winsoundevent:Notification.Reminder"/> </toast> 




As mentioned, these interactive elements can be used to run code through the background tasks of your application so that users can stay in the current context, but have the opportunity to interact with your application. To do this, you need to declare a new background task in Package.appxmanifest, using the new type “Push notification”:



In the background task itself, you can now handle the predefined arguments and user input as follows:
 namespace Tasks { public sealed class ToastHandlerTask : IBackgroundTask { public void Run(IBackgroundTaskInstance taskInstance) { //Retrieve and consume the pre-defined //arguments and user inputs here var details = taskInstance.TriggerDetails as NotificationActionTriggerDetails; var arguments = details.Arguments; var input = details.Input.Lookup("1"); // ... } } } 


The work with adaptive and interactive notifications is described in more detail in the corresponding article of the command of tiles and notifications .

Implementing adaptive live tiles


Similar to notifications, when working with live tiles in Windows 10 , you also have the flexibility to visualize tiles through a markup language. Previously, you had to select a tile pattern from the pattern catalog for previous versions of Windows. The adaptive nature of live tiles now allows you to group content so that Windows can automatically adjust the amount of information displayed on the tile to the screen of the current device.

As an example, in an application that displays letters on a live tile, you can decide to show a preview of one letter on a tile in small phone screens and show a preview of two letters on large screens simply by grouping letters in a single markup:

 ... <binding template="TileWide" branding="nameAndLogo"> <group> <subgroup> <text hint-style="subtitle">Jennifer Parker</text> <text hint-style="captionSubtle">Photos from our trip</text> <text hint-style="captionSubtle">Check out these awesome photos I took while in New Zealand!</text> </subgroup> </group> <text /> <group> <subgroup> <text hint-style="subtitle">Steve Bosniak</text> <text hint-style="captionSubtle">Build 2015 Dinner</text> <text hint-style="captionSubtle">Want to go out for dinner after Build tonight?</text> </subgroup> </group> </binding> ... 




As shown in the example above, live tiles can now be fully defined in the markup, which differs from the previous approach of generating an image (from XAML) and sending it to display the live tile. Let's say you want a live tile to display an image cropped in a circle with two large captions below. You can easily describe it:

 ... <binding template="TileLarge" hint-textStacking="center"> <group> <subgroup hint-weight="1"/> <subgroup hint-weight="2"> <image src="Assets/Apps/Hipstame/hipster.jpg" hint-crop="circle"/> </subgroup> <subgroup hint-weight="1"/> </group> <text hint-style="title" hint-align="center">Hi,</text> <text hint-style="subtitleSubtle" hint-align="center">MasterHip</text> </binding> ... 




More detailed work with adaptive tiles and new markup language is described in the article “ Adaptive Tile Templates - Schema and Documentation ”.

New tip: spend a little time customizing the live tiles of your application to delight users.


We hope we were able to give a brief but sufficient overview of the improvements we made to help you better interact with users through live tiles and notifications in Windows 10. Our new batch of tips:
  1. Consider how you can use the live tile markup language in your application to make beautiful tiles that delight your users.
  2. If the information displayed on the tile can be grouped, make sure that you use adaptive tiles to tune in to users of devices with high-resolution screens.
  3. Start using new online notification features to expand your current notifications by adding additional information and the ability to interact with users.

By the way, do not forget about the new activity “ It's ALIVE !!! ”In DVLUP, through which you can earn points and XP for updating your application (this is in addition to improving user experience).

Finally, below we provide links to additional resources for immersion in the topic of this article. As always, we welcome your feedback on twitter: @WindowsDev , use the hashtag # Win10x10.

Source: https://habr.com/ru/post/265777/


All Articles