Trigger default mobile device alert sound

I'm trying to trigger the default alert sound effect on a user's mobile device when they press the Save button a form.  I browsed the forum for half an hour and can only find reference to using Javascript.

var audio = new Audio('audio_file.mp3');

audio.play();

I don't want to deploy a custom sound and instead want to use the native platform's sound system and alert settings.

Any help is appreciated.

Jeffrey Mendoza wrote:

I'm trying to trigger the default alert sound effect on a user's mobile device when they press the Save button a form.  I browsed the forum for half an hour and can only find reference to using Javascript.

var audio = new Audio('audio_file.mp3');

audio.play();

I don't want to deploy a custom sound and instead want to use the native platform's sound system and alert settings.

Any help is appreciated.

I don't think you can access it by a pure JS.

You have to either go by deploying custom files or

Add some Cordova plugins.

https://github.com/TongZhangzt/cordova-plugin-native-ringtones

Hope it helps,

Assif


Hi Jeffrey,

For your use-case, you can use the below mentioned plugin from Forge. I tried the beep action defined in the plugin and it's triggering the default device alert ringtone (tested in Android Device).

Forge Plugin: https://www.outsystems.com/forge/component-overview/1490/dialogsplugin

Git Link: https://github.com/apache/cordova-plugin-dialogs#navigatornotificationbeep


Hope this helps you!


Regards,

Benjith Sam