Alex Turnbull
Alex Turnbull

Reputation: 259

Background Task WP8 - Access to isolated storage

I am trying to access the files on my windows phone's storage. I know that they are completely independent of each other as one is a windows phone app and the other is windows runtime component.

  public void Run(IBackgroundTaskInstance taskInstance)
    {
        BackgroundTaskDeferral _defferal = taskInstance.GetDeferral();
        System.Diagnostics.Debug.WriteLine("Starting Offline Functionality");

        _defferal.Complete();
    }

This method runs when the network state is changed. From here i want to access the phones storage. has anyone done this before, or can think of any work arounds?

I am running visual studio 2012 with windows phone 8.1

Upvotes: 1

Views: 392

Answers (1)

Rob Caplan - MSFT
Rob Caplan - MSFT

Reputation: 21919

Yes, you can. Using isolated storage is the recommended way to pass data between the background task and the foreground app. You can use a mutex, to prevent the two processes from interfering with each other if they both end up running at the same time.

See MSDN's Communication between foreground app and background agent and Quickstart: Working with files and folders in Windows Phone 8

Upvotes: 1

Related Questions