none
[WPSL] How to play the default notification sound that is configured for my app?

    Question

  • Hi,

    in Windows Phone 8 under Settings -> notifications+actions -> <my app> -> Notification sound I can configure the sound that gets played on incoming notifications.

    Is it possible to play that configured sound programmatically from inside my app?

    Thanks! Mario.




    • Edited by Fred Bao Monday, October 19, 2015 6:47 AM add the tag
    Friday, October 16, 2015 8:30 AM

Answers

  • Hey Mario,

    Unfortunately no, there is no way to retrieve the notification sound that the user has selected in the operating system's Notifications & Actions settings for an app.

    You could have your own sound settings inside your app, and then the user could change the sound from within your own app's settings. That'd be the only way to achieve your scenario. If you went this route, when you pop a toast, you'd retrieve the sound setting from your app's own settings and specify that on the <audio> element in your toast. However, if the user changed your app's notification sound from the operating system settings, that selection will override your <audio> element.


    • Proposed as answer by andrewbares7 Friday, October 23, 2015 5:43 PM
    • Edited by andrewbares7 Friday, October 23, 2015 5:43 PM
    • Marked as answer by Fred Bao Tuesday, November 3, 2015 8:03 AM
    Friday, October 23, 2015 5:43 PM

All replies

  • >>Is it possible to play that configured sound programmatically from inside my app?

    If the notification you mentioned is the toast notification, the answer is yes, while it requires that your windows phone has been Windows Phone 8 Update 3. If your windows phone meets this requirement, you could customize the notification use reflection to access the new Sound property of the ShellToast class, for details, please check this link:

    Using custom sounds in toasts on Windows Phone 8 Update 3 

    However, after searching in our inner sites, it seems notifications for tile, alarm and reminders does not have such a capability.

    Regards.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, October 19, 2015 6:55 AM
  • Yes I do use toast notifications.

    But what I like to achieve is the following: when my app is running in foreground and it receives a toast notification, I would like to play the user's configured notification sound (i.e. I *do not* want to play a custom sound). Therefore I am looking for something like this:

    pushChannel.ShellToastNotificationReceived += (sender, e) => {SystemSounds.Notification.Play();};

    Is that possible?

    Tuesday, October 20, 2015 8:06 AM
  • >>Therefore I am looking for something like this:

    pushChannel.ShellToastNotificationReceived += (sender, e) => {SystemSounds.Notification.Play();};

    Since the SystemSounds is not available in windows phone, it is available in .NET, this approach could not achieve it.

    >> I would like to play the user's configured notification sound (i.e. I *do not* want to play a custom sound).

    So you want to play a system sound, then you could configure it in the audio element of the toast by setting the src attribute:

    https://msdn.microsoft.com/en-us/library/windows/apps/xaml/br230842.aspx

    Regards.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, October 20, 2015 9:31 AM
  • Hey Mario,

    Unfortunately no, there is no way to retrieve the notification sound that the user has selected in the operating system's Notifications & Actions settings for an app.

    You could have your own sound settings inside your app, and then the user could change the sound from within your own app's settings. That'd be the only way to achieve your scenario. If you went this route, when you pop a toast, you'd retrieve the sound setting from your app's own settings and specify that on the <audio> element in your toast. However, if the user changed your app's notification sound from the operating system settings, that selection will override your <audio> element.


    • Proposed as answer by andrewbares7 Friday, October 23, 2015 5:43 PM
    • Edited by andrewbares7 Friday, October 23, 2015 5:43 PM
    • Marked as answer by Fred Bao Tuesday, November 3, 2015 8:03 AM
    Friday, October 23, 2015 5:43 PM
  • Hi Andrew,

    many thanks for clarifying this! I'll just stay with letting the device vibrate on an incoming notification.

    Monday, November 2, 2015 8:26 AM