locked
How to update isolated storage value one when update of an app RRS feed

  • Question

  • Hi,

    I created and set a value in isolated storage in the version 1.0. after upgrading the version 2.0, the value which i set in version 1.0 remain the same. I wanted to change that value only once.

    Can anyone help me on this.


    Windows Desktop, Windows Phone developer.

    Thursday, September 19, 2013 8:37 AM

Answers

  • you can use a background task with this trigger:

    BackgroundTaskBuilder builder = new BackgroundTaskBuilder();
                builder.SetTrigger(new SystemTrigger(SystemTriggerType.ServicingComplete));


    Microsoft Certified Solutions Developer - Windows Store Apps Using C#

    Thursday, September 19, 2013 8:52 AM
  • Are you writing a Windows Phone app or a Windows Store app? Isolated storage is Windows Phone only, but you posted in the Windows Store app development forum.

    Dave's suggestion is for Windows Store apps. It is probably overkill if you just want to update one setting, but see How to use the ServicingComplete trigger for more details.

    --Rob

    Thursday, September 19, 2013 2:26 PM
    Moderator

All replies

  • you can use a background task with this trigger:

    BackgroundTaskBuilder builder = new BackgroundTaskBuilder();
                builder.SetTrigger(new SystemTrigger(SystemTriggerType.ServicingComplete));


    Microsoft Certified Solutions Developer - Windows Store Apps Using C#

    Thursday, September 19, 2013 8:52 AM
  • thanks.. i will use it..

    Windows Desktop, Windows Phone developer.

    Thursday, September 19, 2013 10:37 AM
  • Are you writing a Windows Phone app or a Windows Store app? Isolated storage is Windows Phone only, but you posted in the Windows Store app development forum.

    Dave's suggestion is for Windows Store apps. It is probably overkill if you just want to update one setting, but see How to use the ServicingComplete trigger for more details.

    --Rob

    Thursday, September 19, 2013 2:26 PM
    Moderator
  • i am creating windows store app.

    I have a one more query regarding ServicingComplete trigger.

    Say i am on version 1.0, which doesn't implemented ServicingComplete background task, and in 2.0 i have a servicingComplete background task. If i upgrade from 1.0 to 2.0, will the backgroundtask of 2.0 will call?


    Windows Desktop, Windows Phone developer.

    Wednesday, September 25, 2013 10:14 AM
  • No, the background task cannot be called before it is registered.

    If you have just one simple value why not check it and update it whenever V2 launches? Checking a single value is likely cheaper than setting up and running the background task.

    --Rob

    Wednesday, September 25, 2013 7:45 PM
    Moderator
  • I registered background task in V2.0 in the OnLaunched Event, still it will not call background task?

    i have one more query:

    my background task is not triggered when i update my app using side loading, but i am able to simulate servicing complete event using visual studio, in this case background task is running. Is there any restriction in servicingcomplete event?


    Windows Desktop, Windows Phone developer.

    Thursday, September 26, 2013 3:52 AM
  • The background task will run if the app is updated after the task has been registered. Since it doesn't get registered until 2.0 has already been installed and run it won't trigger until you update to the next version after 2.0.

    I believe this should trigger when side-loading, but I don't know for sure offhand. Again though, I would avoid using a trigger for the scenario you have described. It is much more complicated than you need to deal with.

    --Rob

    Thursday, September 26, 2013 4:44 PM
    Moderator