locked
Unpinning from start screen RRS feed

  • Question

  • The Secondary tile sample shows unpinning happening from within the app.  What happens when the user unpins from the start screen? Is the app notified in any way?

    The reason I would like to be notified is that I am generating the images on the fly from a canvas element, and then saving the result to a file (because the SecondaryTile constructor needs a uri).  I would like to then delete the images when the user unpins them, to save space.

    Wednesday, July 11, 2012 5:53 PM

Answers

  • Matthew,

    Personally I would not bother creating a background task.  It will drain the battery and use CPU (especially important on low power portable platforms).  How about simply test when your app starts and if necessary cleanup then?  I would use the local folder instead of the temp folder in that case since you control when to delete the image.

    -Jeff


    Jeff Sanders (MSFT)

    Thursday, July 12, 2012 1:45 PM
    Moderator

All replies

  • After thinking about it, is it even necessary for me to save a copy of the image?  Does Windows create a copy for itself?

    If so I could create the file in a temp folder (assuming this is possible from javascript, I've haven't tried it yet) and let Windows handle disposing of it when its temp folder cleaner does its job.

    Wednesday, July 11, 2012 6:05 PM
  • Hi,

    Your application will not get notified if the user unpins the tile from the start screen. Actually, user can unpin the tile even if your app is not running.

      >>  I could create the file in a temp folder (assuming this is possible from javascript, I've haven't tried it yet)

    Yes, you do have access to a temporary file. Each app has its own temp storage folder. You can refer to http://msdn.microsoft.com/en-us/library/windows/apps/Hh701395.aspx for more information. However, secondary tile requires the logo image to be in the local storage folder or application installation folder or cloud. So the solution in my mind is to manually check if a tile is pined, and remove the unused image if necessary.

    Best Regards,

    Ming Xu.


    Please mark the replies as answers if they help or unmark if not.
    If you have any feedback about my replies, please contact msdnmg@microsoft.com.
    Microsoft One Code Framework

    Thursday, July 12, 2012 10:47 AM
    Moderator
  • Thanks Ming Xu, this points me in the right direction.  It sounds like the correct way to handle this is to create a background task with a maintenance trigger of once per day (or less) that queries for pinned items and delete the files that are no longer pinned.
    Thursday, July 12, 2012 1:41 PM
  • Matthew,

    Personally I would not bother creating a background task.  It will drain the battery and use CPU (especially important on low power portable platforms).  How about simply test when your app starts and if necessary cleanup then?  I would use the local folder instead of the temp folder in that case since you control when to delete the image.

    -Jeff


    Jeff Sanders (MSFT)

    Thursday, July 12, 2012 1:45 PM
    Moderator