i read the msdn overview on Background audio and took a look at the example app but I'm a little bit confused about messages and the data that could be exchanged through them.
ValueSet messageDictionary = new ValueSet();
messageDictionary.Add("key", "value");
BackgroundMediaPlayer.SendMessageToBackground(messageDictionary);
The new introduced object ValueSet with KeyValuePairs(string, object) has to be used for communication between foreground and background task.
I would like to send instances of custom classes (let's say Audiofiles containing Artist, Album, Filepath, etc. of an medialibrary) to the background task. Unfortunately that is not possible (=>Exception, type not supported) - it seems that only primitive values are allowed.
Of course, a possibility would be to serialize the data. Does anyone know an easier way, or Microsoft's recommended way?
====================================
UPDATE:
Only possible way seems to
(i) serialize the data and send it via the messages
(ii) store the data in a file and communicate the background task to process them
nevertheless, I would be grateful for any recommendations to this topic :-)