I have a WP7 application that I run successfully on both WP7 and WP8 devices. In the app I download audio files using the BackgroundFileTransfer
service and store the files to the shared/transfers
folder. I then create AudioTrack
s by giving a URI to the downloaded file locations.
Uri episodeLocation;
try
{
using (IsolatedStorageFile iso = IsolatedStorageFile.GetUserStoreForApplication())
{
Debug.WriteLine(" *** Creating track, file exists: " + iso.FileExists("shared/transfers/song.mp3"));
}
episodeLocation = new Uri("shared/transfers/song.mp3", UriKind.Relative);
} catch(Exception) {
return null;
}
return new AudioTrack(episodeLocation,
"Track name",
"Album name",
"",
new Uri("/path/to/logo", UriKind.Relative));
This works great on both Windows Phone 7 and Windows Phone 8 devices - audio player is able to play the track just fine. The debug output prints True
as the result for the test if file exists.
I've now converted the application in Visual Studio 2012 to be a Windows Phone 8 application. If I now run the application in Windows Phone 8, I get a System.IO.FileNotFoundException
external exception from the player. Also in the converted version the debug output prints True
when checking if the file exists.
I only converted the app from a WP7 to WP8 app and I cannot refer to files in shared/transfers
any more.
Why?
What's the proper way to do this?
I already tried referring to the files by using the URI isostore:/shared/transfers/song.mp3
but that didn't seem to have an effect.