I'm currenly writing an app where I need to use custom sound for toast notifications (which is sent from cloud). MSDN states that the audio clip must be stored in the app's installation directory or local storage folder. So how is this done?
I tried the CopyToIsolatedStorage()
code sample from How to play background audio for Windows Phone. It fetches the audio clip correctly but when the toast should be shown the device won't play any audio or even show the toast which indicates that it can't find the audio clip correctly. In the app, I have a method which shows contents of the push notification when the app is in foreground. From there I can see that the toast notification is sent and received correctly with toast.mp3 sound tag. So the problem must be in the app but I can't figure out what I did wrong.
Tl;dr version: I want to change toast notification sound, my device is running WP8 with Update 3 and I have a 5 sec long mp3. I can't figure out how and where I should put the audio clip.
SetProperty(toast, "Sound", new Uri("toast.mp3", UriKind.RelativeOrAbsolute));
but it throws FileNotFoundException. So the system cannot find the audio clip automatically (filename parsed from push notification) nor manually (SetPropety). – pasikAudio
directory, you'll need to include that in the pathnew Uri(@"Audio\toast.mp3", UriKind.RelativeOrAbsolute)
– WiredPrairie<wp:Sound>toast.mp3</wp:Sound>
tag and when the app is in background, the system handles push and toast notifications. The manual handling part was only a test. I checked Using custom sounds in toasts on Windows Phone 8 Update 3 but the information there is quite minimal... – pasik