locked
How do I reset a flipping Mango Tile after push notification? RRS feed

  • Question

  • Hey,

    first of all, I love the flipping tiles that come with Mango.

    I got everything working so far. The tile gets updated and displays the content on the back.
    But after starting the app, I want to reset it to not flipping anymore and just show the static tile.

    I tried by setting the back values in the update to empty strings and also to not include these values at all. Both didn't work.
    It doesn't say anything here: http://msdn.microsoft.com/en-us/library/hh202970(v=VS.92).aspx

    Any help appreciated. Thank you.
    Wednesday, July 6, 2011 7:21 PM

Answers

  • Note: This appears to be broken in the public beta images, both the Emulator as well as phone build 7712, in that the tile continues to flip to a blank tile...

    However, the way to clear the back tile is to set Action=Clear for all back tile elements.
    In your example you would use code like this:

        //BackBackgroundImage  
        writer.WriteStartElement("wp""BackBackgroundImage""WPNotification");  
        writer.WriteAttributeString("Action""Clear");  
        writer.WriteEndElement();  
     
        //BackTitle  
        writer.WriteStartElement("wp""BackTitle""WPNotification");  
        writer.WriteAttributeString("Action""Clear");  
        writer.WriteEndElement();  
     
        //BackContent  
        writer.WriteStartElement("wp""BackContent""WPNotification");  
        writer.WriteAttributeString("Action""Clear");  
        writer.WriteEndElement();  
     

    And here's a version for those that prefer to see the XML in string form:
    string szXML = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +  
                   "<wp:Notification xmlns:wp=\"WPNotification\">" +  
                   "<wp:Tile>" +  
                   "<wp:BackgroundImage>Background.png</wp:BackgroundImage>" +  
                   "<wp:Count>0</wp:Count>" +  
                   "<wp:BackBackgroundImage Action = \"Clear\"></wp:BackBackgroundImage>" +  
                   "<wp:BackTitle Action = \"Clear\"> </wp:BackTitle>" +  
                   "<wp:BackContent Action = \"Clear\"> </wp:BackContent>" +  
                   "</wp:Tile>" +  
                   "</wp:Notification>";  
     
    Tuesday, August 2, 2011 7:18 PM

All replies

  • The documentation and sample you want to check out is "How to: Create, Delete, and Update Tiles for Windows Phone" here:
    http://msdn.microsoft.com/en-us/library/hh202979(VS.92).aspx

    And the finished TileSample download is here.
    http://msdn.microsoft.com/en-us/library/ff431744(VS.92).aspx

    For your particular question you probably want to review the function "checkBoxDisplaySecondaryTile_Unchecked" in the file "SecondaryTile.xaml.cs".
    Thursday, July 14, 2011 10:59 PM
  • Thank you for the response.

    But I am not referring to a secondary tile but to the back of the application tile. 

    Let me be more specific:

    In the idle state of my app, the application tile only displays the front tile. Then, when some information changed, I send a tile notification containing an update for the front and back of the tile. My tile starts flipping and shows the front and back information how I sent it from my service.

    Then the user reacts to the update and opens the app. Now I want the tile to return to it's non-flipping state as it used to be before the tile notification.
    I then send a tile notification again with only the front tile information, but the tile keeps on flipping and still shows the back of the tile.

    In my service, this is what I am doing: 
    private static byte[] CreateTileUpdate(string TileTitle, int TileCount, string TileImageURL, string TileBackContent) 
            { 
                // Use XmlWriter to construct notification structure/contents. 
                MemoryStream stream = new MemoryStream(); 
                XmlWriterSettings settings = new XmlWriterSettings() { Indent = true, Encoding = new UTF8Encoding(false) }; 
                XmlWriter writer = XmlWriter.Create(stream, settings); 
                writer.WriteStartDocument(); 
                writer.WriteStartElement("wp""Notification""WPNotification"); 
                writer.WriteStartElement("wp""Tile""WPNotification"); 
                writer.WriteStartElement("wp""BackgroundImage""WPNotification"); 
                writer.WriteValue(TileImageURL); 
                writer.WriteEndElement(); 
                writer.WriteStartElement("wp""Count""WPNotification"); 
                writer.WriteValue(TileCount); 
                writer.WriteEndElement(); 
                writer.WriteStartElement("wp""Title""WPNotification"); 
                writer.WriteValue(TileTitle); 
                writer.WriteEndElement(); 
     
                if (string.IsNullOrEmpty(TileBackContent)) 
                { 
                    // Reset back of the tile 
                    writer.WriteStartElement("wp""BackBackgroundImage""WPNotification"); 
                    writer.WriteValue(""); 
                    writer.WriteEndElement(); 
                    writer.WriteStartElement("wp""BackContent""WPNotification"); 
                    writer.WriteValue(""); 
                    writer.WriteEndElement(); 
                    writer.WriteStartElement("wp""BackTitle""WPNotification"); 
                    writer.WriteValue(""); 
                    writer.WriteEndElement(); 
                } 
                else 
                { 
                    // Set back of the tile 
                    writer.WriteStartElement("wp""BackBackgroundImage""WPNotification"); 
                    writer.WriteValue(""); 
                    writer.WriteEndElement(); 
                    writer.WriteStartElement("wp""BackContent""WPNotification"); 
                    writer.WriteValue(TileBackContent); 
                    writer.WriteEndElement(); 
                    writer.WriteStartElement("wp""BackTitle""WPNotification"); 
                    writer.WriteValue("ShoppingList"); 
                    writer.WriteEndElement(); 
                } 
     
                writer.WriteEndElement(); 
                writer.WriteEndElement(); 
                writer.WriteEndDocument(); 
                //Transfer Xml output from writer's buffer to myStream. 
                writer.Flush(); 
                //Send this message to all subscribed devices. 
                return stream.ToArray(); 
            } 

    It is working fine for setting the front and back of the tile, but it does not reset the tile to stop flipping.

    Thanks.
    Tuesday, July 19, 2011 9:03 AM
  • Note: This appears to be broken in the public beta images, both the Emulator as well as phone build 7712, in that the tile continues to flip to a blank tile...

    However, the way to clear the back tile is to set Action=Clear for all back tile elements.
    In your example you would use code like this:

        //BackBackgroundImage  
        writer.WriteStartElement("wp""BackBackgroundImage""WPNotification");  
        writer.WriteAttributeString("Action""Clear");  
        writer.WriteEndElement();  
     
        //BackTitle  
        writer.WriteStartElement("wp""BackTitle""WPNotification");  
        writer.WriteAttributeString("Action""Clear");  
        writer.WriteEndElement();  
     
        //BackContent  
        writer.WriteStartElement("wp""BackContent""WPNotification");  
        writer.WriteAttributeString("Action""Clear");  
        writer.WriteEndElement();  
     

    And here's a version for those that prefer to see the XML in string form:
    string szXML = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +  
                   "<wp:Notification xmlns:wp=\"WPNotification\">" +  
                   "<wp:Tile>" +  
                   "<wp:BackgroundImage>Background.png</wp:BackgroundImage>" +  
                   "<wp:Count>0</wp:Count>" +  
                   "<wp:BackBackgroundImage Action = \"Clear\"></wp:BackBackgroundImage>" +  
                   "<wp:BackTitle Action = \"Clear\"> </wp:BackTitle>" +  
                   "<wp:BackContent Action = \"Clear\"> </wp:BackContent>" +  
                   "</wp:Tile>" +  
                   "</wp:Notification>";  
     
    Tuesday, August 2, 2011 7:18 PM
  • Note: This appears to be broken in the public beta images, both the Emulator as well as phone build 7712, in that the tile continues to flip to a blank tile...

    However, the way to clear the back tile is to set Action=Clear for all back tile elements.
    In your example you would use code like this:

    Hi, no solution for reset from the app?
    Thursday, September 1, 2011 10:07 PM
  • To do this locally you should be able to set all the Back* values, of your StandardTileData object passed to ShellTile.Update(...) , like so:

     

        BackContent = "" 
        BackBackgroundImage = new Uri("", UriKind.Relative)  
        BackTitle = "" 

    Friday, September 2, 2011 9:26 PM
  • To do this locally you should be able to set all the Back* values, of your StandardTileData object passed to ShellTile.Update(...) , like so:

     

        BackContent = "" 
        BackBackgroundImage = new Uri("", UriKind.Relative)  
        BackTitle = "" 


    this doesn't work. if i set this value to "" or null, the Tile always Flip .

    Only with send particolar xml (with action=clear) from server stop flipping the Tile.. :/

    Edit: SORRY! i tried with new Uri("", UriKind.Relative) and now work fine! thanks! :)
    Saturday, September 3, 2011 12:55 AM