2

Want I remember to have heard was that with WNS, you can specify a special sound for the notification you send, as is done for Android.

I have looked on different sites msdn, urban and microsoft examples, only reference I have found regarding toast sounds does not seem to specify it.

Am I missing something ? Is it not possible for WNS?

Further is it possible to send a badge message together with toast and sound? Or what are the limits, cannot seem to find it in the above links.

I would like a link or a XML example I can try on my server. Thanks!

Community
  • 1
  • 1
JTIM
  • 2,774
  • 1
  • 34
  • 74

1 Answers1

4

First, to specify a custom toast notification sound via WNS you need to create the payload with the audio tag for example:

<toast launch=\"$param\">
   <audio src=\"ms-appx:///Assets/Sounds/sound.wav\"/>
   <visual>
       <binding template=\"ToastText04\">
           <text id=\"1\">$title</text>
           <text id=\"2\">$msg</text>
       </binding>
   </visual>
</toast>

Note the path to the audio file. For the sound to play, you need to have the audio file (which can be mp3 too i think) prepackaged with your app. In this case the audio file is in the Assets/Sounds folder in your project. If the specified path does not exist, the default notification sound will play.

For the badge notifications, sound is not supported. You must send a seperate notification with the badge schema.

Kristian Vukusic
  • 3,284
  • 6
  • 30
  • 46
  • Okay so just to clarify badge is a separate type you cannot integrate it? So I would need to send two notifications, e.g. Toast and sound, and one for tile and badge ? :) – JTIM Oct 15 '15 at 21:16
  • Exactly! You can see the difference between [toast](https://msdn.microsoft.com/en-us/library/windows/apps/br230849.aspx) and [tile](https://msdn.microsoft.com/en-us/library/windows/apps/br212859.aspx) schemes on the links. The `toast` supports `audio`, and `tile` doesn't. For badge you need to send a seperate notification. – Kristian Vukusic Oct 15 '15 at 21:19
  • Great just one last follow up. Ms-apx, as you refer to in the sound is this for WinRT apps? Because mine is a Silverlight using wns. Should I need another prefix for sound? Lastly (I hope :) ) can you specify duration for the sound ? – JTIM Oct 15 '15 at 21:24
  • For the silverlight part I'm not sure, but you can try. If it does not work try with `ms-appdata` or without the prefix (just src="/Assets..."). You can't specify duration, but you can create the audio file of your preferred duration. – Kristian Vukusic Oct 15 '15 at 21:36
  • I am sorry but hope a follow up is in order :) I remember to have read that when you send a WNS toast message you can specify the image shown with the notification is this correct? And if so what is the xml for it? Hope you have time to answer ! – JTIM Nov 01 '15 at 12:40
  • 1
    You can display images in toast notifications only on the `Windows 10` platform (when you create a Windows Universal App). For Windows 8.1 it is not possible. If you some day start to develop a Win10 app [check here](http://blogs.msdn.com/b/tiles_and_toasts/archive/2015/07/02/adaptive-and-interactive-toast-notifications-for-windows-10.aspx) how the xml looks like – Kristian Vukusic Nov 01 '15 at 13:37
  • Sorry I was not clear. When you receive a notification on Wp8.1, there is an image/loge displayed with the text. How to decide what logo is displayed here with the xml? or is this not possible? – JTIM Nov 01 '15 at 13:48
  • Aha, this is one of the images specified in your app manifest from the Visual Assets tap. I don't know which one it is but it is either the `Square 44x44` or the `Store Icon` images. This cannot be changed with the toast notification XML on WP8.1. – Kristian Vukusic Nov 01 '15 at 14:53