Reputation: 679
For a WP7 app I have managed to get a PeriodTask running as per some examples on msdn (sends out a toast message). Now looking to extend to do what I want.
The task is running in the background and I have no need for it to communicate with the foreground app if that is running. I am just a little unsure of what I am allowed to do within this background task, and what code I can access from it.
I would like to be able to access the database that I am using (Sterling) and then update a live tile. Presumably, since its running independently then I will need to open the database - do what I need to do re the tile and then close the database within this background process. This should be okay? And from within my ScheduledAgent class OnInvoke method I can call code that is defined on a class in my foreground project as long as I include a reference to that project in my ScheduledTask project. There are no issues with that code running inside my Background Periodic Task application?
Upvotes: 2
Views: 1957
Reputation: 6142
In my solution I added a small Data Model project where I created a class to represent the data/model. From the main app I store that instantiated object to the isolated storage. In the scheduletaskproject you can then just retrieve that stored instance from isolated storage if you also reference the small Model project.
If I'm not mistaken there is also a 5mb memory limit. So using a DB inside the scheduletaskproject could be a problem ( reference: http://csainty.blogspot.com/2011/08/wp75-mangobackground-agents.html )
Upvotes: 0
Reputation: 65564
In a BackgroundAgent you can do anything apart from use the APIs in the unsupported list: http://msdn.microsoft.com/en-us/library/hh202962(v=vs.92).aspx
The "Marketplace Test Kit" will detect use of any unsupported APIs.
Upvotes: 2