129
Views
2
Comments
Trigger default mobile device alert sound
Question

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.

2021-04-09 11-42-43
assif_tiger
 
MVP

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


2021-03-18 21-03-15
Benjith Sam
 
MVP

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

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.