Sume Rossini
Sume Rossini

Reputation: 77

How can data be shared between a Windows store app and a Background task?

I am creating a Windows store client that uses google services. I added a Background task (as a Windows Runtime Component) to update the app live tiles every 30 minutes. Problem is, I need to make a network call that requires a token. The token is available in the Windows store app's global variables and settings. How can I access it from the Background task?

Upvotes: 1

Views: 707

Answers (1)

Jared Bienz - MSFT
Jared Bienz - MSFT

Reputation: 3550

The UI app and the background task cannot share memory. The only way they can share data is by writing it out to application storage via ApplicationData.Current.LocalFolder. However, that location is not secure and you should not write sensitive information like tokens or keys there.

I would recommend embedding the token in the Background Task project in the same way you embedded it in the UI project (usually as a resource or as a code constant).

Upvotes: 1

Related Questions