locked
Can I use notification to play customized sound? RRS feed

  • Question

  • Hi,

    In my iOS and Android apps I can specifiy a custom audio file in my push notification and the notification manager will play the customised wav/mp3 file when the notifcation is received. Is there a way of doing this on windows phone (8.1) or do I have to limit myself to the provided audio sounds.

    Thanks

    Ciarán

    Monday, September 8, 2014 3:03 PM

Answers

  • Windows Phone 8 Update 3 (OS version number 8.0.10492) introduces the ability to provide a custom sound for toast notifications. Sound files can be in WAV, WMA, or MP3 format, must be less than 10 seconds long, and must be stored in the app’s installation directory or local storage folder. http://msdn.microsoft.com/en-us/library/windows/apps/jj662938(v=vs.105).aspx#BKMK_gdr3
    Monday, September 8, 2014 7:27 PM
    Moderator
  • Actually, I (and Oliver) missed a footnote in the Push Notification documentation for Windows Phone 8.1 which says you can, in fact, play cusomized audio from toast. The docs weren't clear about how to format the audio element in the xml but by trial and error I now have it working

    audio.SetAttribute("src", string.Format("ms-appx:///Resources/Raw/{0}", sound));

    • Marked as answer by ciaran_mac_hkc Thursday, September 18, 2014 1:12 PM
    Thursday, September 18, 2014 1:12 PM

All replies

  • Windows Phone 8 Update 3 (OS version number 8.0.10492) introduces the ability to provide a custom sound for toast notifications. Sound files can be in WAV, WMA, or MP3 format, must be less than 10 seconds long, and must be stored in the app’s installation directory or local storage folder. http://msdn.microsoft.com/en-us/library/windows/apps/jj662938(v=vs.105).aspx#BKMK_gdr3
    Monday, September 8, 2014 7:27 PM
    Moderator
  • It wasn't clear from what I read if it's possible to send a customized audio in a push toast notifcation?

    (That is - can it only be sent in a raw psuh notification?)

    Thanks

    Thursday, September 11, 2014 9:53 AM
  • The sound file has to be part of the application package. You can not attach a custom sound to the push message itself. However you can select which sound file to play as part of the message.
    Thursday, September 11, 2014 10:02 AM
  • And just to be clear - I can specify this sound file using a toast push notification? (as opposed to a raw notification). Where are the guidelines on how the audio needs to be formatted and compiled into the package (special folders etc.)
    Thursday, September 11, 2014 10:11 AM
    • Proposed as answer by Oliver Ulm Thursday, September 11, 2014 11:46 AM
    Thursday, September 11, 2014 11:46 AM
  • Actually, I (and Oliver) missed a footnote in the Push Notification documentation for Windows Phone 8.1 which says you can, in fact, play cusomized audio from toast. The docs weren't clear about how to format the audio element in the xml but by trial and error I now have it working

    audio.SetAttribute("src", string.Format("ms-appx:///Resources/Raw/{0}", sound));

    • Marked as answer by ciaran_mac_hkc Thursday, September 18, 2014 1:12 PM
    Thursday, September 18, 2014 1:12 PM