Use a StorageHandler from ScheduledTaskAgent on WP7

Topics: Extensibility, Feature Requests, Framework Services
Dec 8, 2011 at 4:45 PM

Is there a way to use a StorageHandler from the context of a ScheduledTaskAgent on WP7?

My app is making use of a StorageHandler to save application settings. I need to access the application settings from the ScheduledTaskAgent, it runs in the background on the phone and has it's own lifecycle separate to the app. I'm struggling to get access to the application settings from there.

I tried creating an instance on the specific StorageHandler I need from the background agent, calling .Configure() and then .Restore() on it but it won't work due to dependencies on the StorageCoordinater and ultimately IPhoneService (which doesn't really make sense from this context).

What's the best way to make this work? I was thinking of implementing a BackgroundContainer  : SimpleContainer, IPhoneContainer (to replace PhoneContainer with only services required in the background) and BackgroundTaskService : IPhoneService (to replace PhoneApplicationServiceAdapter to implement the lifecycle events).