Jump to content

RS Web Service Extensions to support Live Tiles


Recommended Posts



I've had a play with creating Windows store apps that talk to the recording service API and I'm getting somewhere.


I thought it would be nice to have a little tile that told me about the recording service, recordings due etc so I have an easy place to check to see if it's Ok to put the computer to sleep.


I've got it done - see attached. It's s live tile that updates every 30 minutes, and lists recordings coming up in the next hour. It's possible to make it 'live' instead of every 30 minutes, but a lot of work for not much benefit.


This tile updates without the app needing to run (the app itself doesn't do very much at the moment) but it needs a web service. The web service simply supplies a little XML that the tile uses to update itself.


So I created a little web service that draws live data from the RS API in order to provide live updates to the tile.


The web service is only a few lines of XML so I wondered if you would be able to include little tile and badge pages in the Recording Service API itself and save the need for an additional web service. The tile and badge service XML feeds required for the attached tile are below.



<?xml version="1.0"?>
-<tile>-<visual>-<binding template="TileWideText09"><text id="1">Imminent Recordings</text><text id="2">This Is BBC Four ; </text></binding>-<binding template="TileSquareBlock"><text id="1">1</text><text id="2">Active Recordings</text></binding></visual></tile>



<?xml version="1.0"?>
<badge value="1"/>

In the badge example, the number supplied is simply the number of recordings due in the next hour.



Link to comment

I'll do the tile, I just need that simple XML from the web service. When Windows refreshes the tile, it won't run any code I've written, it simply gets the XML for the tile from a web service and re-draws the tile.


If you can offer a simple extension to the web service that provides XML that I can use to populate the tile (I can give you the XML) and dynamically replaces a couple of values - forthcoming recording names, number of recordings, then Windows can update the tile from the XML in the recording service API.


You'd have an extension, like tileupdate.html and badgeupdate.html. My webservice currently provides the XML through the following code, using a recording service object (rs) created through a class library I wrote.


            string recs = rs.activeRecordingsInNextHour.ToString();
            string recNames = rs.currentActiveRecordingNames;

            return XElement.Parse(String.Format("<tile><visual><binding template=\"TileWideText09\">" +
                      "<text id=\"1\">Imminent Recordings</text>" +
                      "<text id=\"2\">{1}</text>" +
                    "</binding>" +
                    "<binding template=\"TileSquareBlock\">" +
                      "<text id=\"1\">{0}</text>" +
                      "<text id=\"2\">Active Recordings</text>" +
                    "</binding>" +
                  "</visual>" +
                "</tile>", recs, recNames));


Then Windows just polls this web service every 30 minutes (as instructed by the app) and re-populates the tile based on the XML it receives.

Edited by uglyned
Link to comment

What I mean to ask: How do you actually create such a tile, because I won't implement this only for you. So there has to be a way how other windows 8 users can benefit from it. :)

Link to comment

Oh yeah - it's standard. The only thing that changes is the XML specifies which tile is used. But if you got really clever you could have users specify their own tile names in an ini file and you just put their value in the XML. If you made this XML available, anyone writing their own apps could use it.


The issue would be around tile types - there are many to choose from and the XML will tell Windows which tile to use and provide content specific to that type.


Some of the more useful resources I've found




and - I nicked most of the code for my simple web service from here -




EDIT - and the tile catalogue from which you select your tile - http://msdn.microsoft.com/en-gb/library/windows/apps/hh761491.aspx

Edited by uglyned
Link to comment

I seem to miss something.


Imagine I have actually the clientside xyz.js file for the updates. How do I pin this to the startscreen as a tile?

Link to comment

No Java. Create a Windows App Store app, set the tileupdate location and schedule. Then, even if your app isn't running, Windows will, on the schedule you set, go to the web service you specify, download the tile XML, then re-populate the tile. There's not much too it in the code, it's all pre-defined objects and classes.

            PeriodicUpdateRecurrence currents = PeriodicUpdateRecurrence.HalfHour;
            TileUpdateManager.CreateTileUpdaterForApplication().StartPeriodicUpdate(new Uri("http://server/api/tile?Mediaformat=XML"), currents);
            BadgeUpdateManager.CreateBadgeUpdaterForApplication().StartPeriodicUpdate(new Uri("http://server/api/badge/2?Mediaformat=XML"), currents);
Edited by uglyned
Link to comment

OK. Sorry I don't see a simple way for this to be useful for the "masses".


Would it be a html and/or javascript file easy to integrate into the startscreen as a live tile, I would do it, but it seems MS doesn't want it that easy.


But you're creating an app store app anyway, so just expand it. Download the needed xml data from the improved RS Webapi, compile it into the needed format and feed it to the tiles. Use a ini for user/password/url and you can share your work with other windows 8 users :)

Link to comment

If I did end up releasing it, it would have to be as a stand alone app - at the moment it relies totally on the web service I created to provide the tile update XML. If you could make that little bit of XML available through the RS API (with the dynamic update of a couple of variables) then maybe I'd have a go.


But don't rush = I'm not sure this will ever be a real app. According to MS guidelines the tile should be a teaser - something that entices the user into your app. Problem is there is no app - I wrote it for the tile - the app is empty. I can't think of anything to put in it as I don't want to recreate the wheel.


The only thing I thought of was to display an EPG and timer list and give the user the option to add programmes to the autosearch timers (it's something I've been asking for in DVBViewer forever) but I don't think the autosearch settings are available through the API and I don't want to start messing with files on the local disk.


Thanks for your interest though - if I come across anything really useful I'll post in the forums.

Link to comment

Well my idea was a tile which could connect to a remote RS, not only the a RS.


Locally you can use the Service control app.



ATM I simply ignore the windows 8 installation on my Laptop. Every time I use it, I get the urge to smash something heavy into the screen. Would be a bad and expensive idea. ;)


Well now I have a laptop I don't use anymore. I wonder if there is a downgrade to windows 7?

For me windows 8 simply is the new Vista. Hopefully MS gets the hint and kicks all the useless touch-stuff for desktop installations.

Link to comment

Oh, I thought that was obvious, but apparently not. Uglyneds idea is very cool and doesnt need to be limited for Windows 8 users only. Hopefully he gets it going.

Link to comment

The tile itself doesn't connect to anything. It's just a few lines of XML.


The idea is you have a 'tile server' that offers up the XML that Windows then uses to draw the tile. So I'd need recording service to have the tile XML available if I was going to stop using the webservice I've built.


It took me a while to understand. But the tiles have no logic, no code, they're just a few lines of XML. So they can't look to a webservice, take some data, perform some logic, then refresh accordingly.


All they can do is look to a server, get some tile XML from it, blank themselves and redraw themselves using the XML (instructions, if you like) from the tile server.


They can, however, poll multiple servers and that is configurable from within the app (mine does this now) so you can have the user who installs the app specifying the server it draws its data from within the app. You could also have inbuilt 'central' addresses that the user can, or can't, change - the developer can set this easily.


I guess in that sense it's like an RSS feed. Some styling - colour etc is specified by the software but the content is driven entirely by the tile feed.

Well my idea was a tile which could connect to a remote RS, not only the a RS.

Edited by uglyned
Link to comment

It took me a while to understand. But the tiles have no logic, no code, they're just a few lines of XML. So they can't look to a webservice, take some data, perform some logic, then refresh accordingly.

That's contrary to MS. http://blogs.msdn.com/b/windowsappdev/archive/2012/04/18/creating-a-great-tile-experience-part-2.aspx does read as if you have to have a client app for the stuff. There are several other sources on MSDN which implicate the same...



Anyway, being realistic: Who will really see and use this on a desktop?? I don't see a real application of the startscreen for Desktop users. Well except the really bored ones, who like to stare on some squares with contents updated once every half hour... On a mobile/tablet device it might work, but honestly, on a desktop you only use the startscreen to open the Desktop display or to start a program (if you find it).

Link to comment

Anything that will give information about imminent and ongoing recordings (showname) from plain desktop view and without having to open the webinterface is good. The RS balloon tooltip feature cant do that unfortunately.

Link to comment

That was my reason for writing it. I find the recording service icon in the system tray very useful in earlier versions of Windows but it's hidden under a few layers, annoyingly, in Windows 8. It's useful to have an instant view - is anything recording, or anything about to record? Sometimes I need to reboot the machine, want to put it in standby when I go to bed - Windows Power Management can't always be relied on to put the machine to sleep.


Also your point about Windows 8 is only half valid. It's a big step forward for HTPC dedicated use. The start menu can be controlled by a remote control so as the default screen that appears when the PC wakes up, the Start page is extremely useful. Use the remote control to navigate between icons for applications I may want to launch - XBMC, DVBViewer, PowerDVD, whatever. I can then exit one application, return to start, and launch another rone. No need for a mouse.


But I agree with you - as a work or development machine Windows 8 would drive me up the wall, although I'm having to use it for the tile stuff, and slowly getting used to it.


Looks like the tile updates don't support authentication to a web service easily so maybe the Recording Service API isn't the best place for it anyway. I'll carry on with my webservice and try to find a way to package it up for anyone who wants it.

Link to comment

No it's not! (Although I don't think I could start a post with 'no it's not' and still claim not to be contrary...)


The tiles are generated from a few lines of XML. They get the XML from a web service and use that XML to draw themselves. They won't do anything with that XML, they simply just wipe themselves clean and use the XML they got from the webservice to re-draw themselves.


There are other ways of updating a tile - you can do a lot more from within the app of course - but that will only work while the app is running and Windows can suspend or close running apps at will.


Then there's push - which is effectively 'live' updates, where a web service sends updates to the tile, but that's overkill for this little bit of fun.


That's contrary to MS. http://blogs.msdn.com/b/windowsappdev/archive/2012/04/18/creating-a-great-tile-experience-part-2.aspx does read as if you have to have a client app for the stuff. There are several other sources on MSDN which implicate the same...

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...