Windows 10 UWP–Migrating a Windows 8.1 App–Part 11 of N

It’s been a little while since my last post in this series around taking a Windows 8.1 app and moving it to Windows 10 UWP but I finally found a little time to revisit the application and do some more work in bringing it to the phone.

One of the first things that I noticed in playing with my app on the phone (due to the high DPI) is that my tile notifications weren’t looking too good and for at least 2 reasons.

The kwiQR app is a bit limited when it comes to tile notifications. One feature is that it sets the badge on the tile to denote how many QR codes it has captured which is really an abuse of the badge but, hopefully, the user will forgive me.

The other thing it does on Windows 8.x is to cycle the content of the last 5 QR codes captured on its live tile using notification queuing. Again, this is a slight abuse of the live tile.

In doing that cycling, the app tries to use the right tile image to reflect the type of captured content that it’s showing – e.g. it might be a mail address, a telephone, a contact card, web link or just some unknown type of content.

That’s the ‘functionality’.

Now for the first problem which is that my app only ever generated notifications for wide or large tiles so if the tile was set to be medium size then the user sees nothing which is a bit poor. This was a medium tile on the desktop;

image

whereas the wide tile does show some information (albeit formatted badly on Windows 10) and it uses tile notification queuing to cycle through the last 5 pieces of content acquired from QR codes;

image

whereas the large tile tries to display up to 3 pieces of content on each tile meaning that a user who is using large tiles might have up to 15 pieces of content cycling around 5 queued tile notifications;

image

It’s slightly ‘random’ and it partly comes from the history in that when this app was written there was no such thing as a large tile so that was bolted on later.

It also partly comes from the code being written to hand-generate the XML that it needs (there were no helpers as far as I can remember before Windows 8.0 shipped when this code was written) and that led to a somewhat cautious approach in trying to generate the tile content.

With Windows 10, of course, there are now adaptive tiles and there is also the NotificationExtensions NuGet package and both of which should make life both easier and better for my app code here and I removed a whole class file from my project by including the notification extensions.

There’s also the visualizer in the Store which helps with putting together tiles.

The only challenge that I had in trying to make this work was in trying to mix the adaptive tile mechanism with the tile notification queuing mechanism.

In my scenario, I’m trying to display the N most recent pieces of data on the live tiles and I have up to 5 tiles available via notification queuing.

If I pick a wide tile as an example, on some devices the wide tile can display 1 QR code whereas on others it can display 2. There may be some device where it can display 3 for all I know.

So, if I have 10 QR codes do I submit 5 notifications with 1 code each or 5 notifications with 2 codes each?

For example;

Notification 0: QRCode 0, QR Code 1

Notification 1: QRCode 2, QR COde 3

Now, on some devices QR Codes 1 and 3 won’t be visible but 0 and 2 will and that’s not really what I’d like but I don’t know what codes will be visible at the time of assembling the tiles.

The best I can perhaps do is something like;

Notification 0: QRCode 0, QRCode 1

Notification 1: QRCode 1, QRCode 2

but this is the flip-side of the situation in that, on some devices, I’ll now get duplication Sad smile

It seemed to me that, in the end, it wasn’t easy (possible?) for me to win here and I doubt that this much tile information was really useful in a simple app like this one.

I decided to simplify the whole thing and I disabled notification queuing for my tiles and I just hand up to 5 QR codes to the system and let it figure out what it can/can’t display in a true ‘adaptive tile’ way, e.g this large (desktop) tile;

image

drops down to this wide tile;

image

but on the Lumia 920, that same wide tile would show 2 entries rather than 1 and it’s the system figuring it out so that I don’t have to anymore Smile

Doing this also solved my second problem with my live tiles on the phone – I hadn’t included scaled bitmaps and they were blurry and a side-effect of reworking them completely is that the blurriness has gone away. A double win Smile