Search code examples
windows-phone-8windows-phonelive-tile

How to Update IconicTile & LockScreen defined by WMAppManifest.xml


I'm trying to create an IconicTile for Windows Phone 8. I've defined with VS2012 the type of Tile Template to TemplateIconic and added a Tile Title and two images for small and medium.

If I pin my app to the start screen, I can choose between small and medium tiles like expected.

Now I want to update the IconicTile I defined in my WMAppManifest.xml. As I understand IconicTile, it needs to be updated in code and will also update the LockScreen icon and count, if I defined one. I've added a DeviceLockImageURI and this Extensions:

<Extensions>
  <Extension ExtensionName="LockScreen_Notification_IconCount" ConsumerID="{111DFF24-AA15-4A96-8006-2BFF8122084F}" TaskID="_default"/>
  <Extension ExtensionName="LockScreen_Notification_TextField" ConsumerID="{111DFF24-AA15-4A96-8006-2BFF8122084F}" TaskID="_default" />
</Extensions>

First question: Is this ConsumerID always the same or which ID is it?

To update the IconicTile I've defined in WMAppManifest.xml, I need to get hold of any pinned Tiles of my Application on the screen. I've read a lot of tutorials explaining how to add tiles manually from your application, but I only want to use the tile I've defined in WMAppManifest.xml. Therefore all tutorials recommended to get the current active Tile with this code:

ShellTile.ActiveTiles.FirstOrDefault();

ActiveTiles is an IEnumeration and only offers me: Equals, GetEnumerator, GetHashCode, GetType and ToString

Second question: What am I missing here? Does FirstOrDefault only work for FlipTiles or CycleTiles? I only want to use the IconicTile!

So I'm stuck at identifying the current active IconicTile on the screen, so that I can use an IconicTileData object to update the count or text of the IconicTile. What am I missing here?


Solution

  • For the first question:

    I've seen a Tile ID when you create an IconicTile from Xml:

    <wp:Tile Id="[Tile ID]" Template="IconicTile">
    

    Maybe it is this ID? Otherwise I'll go with allways the same static ID, as there is no documentation on how to create this ID.

    For the second question:

    I've found the error: I was missing

    using System.Linq;
    

    This using enables access to the Linq Methods necessary to use FirstOrDefault or similar commands. I was mislead by

    using System.Xml.Linq;
    

    which is definitevly not the same Linq class ;)