PlaySound standard Notification Sound


#1

Hey there :slight_smile:
Here I can Play a sound wich I choose: https://fuseopen.com/docs/fuse/playsound.html
But can I play the standard notification sound wich each user has on its device?
Thanks :slight_smile:


#2

Push notifications already has a property for that, just pass in "sound":"default" into your notification payload.


#3

Thanks :slight_smile:Yes and that works like a charm for notification.
The Problem is, that if the app is in foreground there is no notification. So I startet to display a custom notification on screen. This works like a charm.
But therefore I want to play also a sound. The only Way I think is to play a Sound with “PlaySound”. But I dont want a special sound implemented, but the standard Sound of the user.
You know what I mean? :confused:


#4

Ok yeah, I know what ya mean, I dunno how to play the devices default sound, I personally would find that quite annoying though, especially if there are a lot of notifications.


#5

You could write your own native module to get the users default notification sound…

Uri uri= RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);

…then just check environment and play it.


#6

Sounds great :+1:t3: thanks a lot :slight_smile:
You are right, too many are annoying, but it is only for a few and the user can easily turn this off :ok_hand:t3: