The buttons in my app make no sounds. The Android back button and keyboard makes it’s native sound. For example, I would love to have the ion-nav-back-button make the same sound as the Android device back button.
What is the recommended way to add native sounds to buttons?
Hi everyone, sorry if i’m reviving a super old post but I just had the same necessity, so I made a small cordova plugin that works on Android (based on the blogpost).
It lets you specify an array of class strings that you want to be “clicky” and when a click event it’s triggered on the class, you will hear the device’s native click sound.
this is exactly what I was looking for. It works perfekt with my Android Device (sony xperia z3 compact). Thanks for that
Just one question. So now I made all „Buttons“ make the click sound. But I really would like to have that Clicksound also on "ion-items“ with a „href“. Here an example:
<ion-item class="item item-icon-left" menu-close href="#/app/cat_list" >
<i class="icon ion-ios-book"></i>
Klick Me with a clicky sound
</ion-item>
So I don’t know how to configure your plugin in that case, since I don’t use buttons here. Any suggestions?
EDIT:
I just found the solution by myself. Since “ion-item” creates and “a” tag with an href, I just needed to add the “a” “class” to your configuration. So it is:
var clickyClasses = ['sound-click', 'button', 'a'];
nativeclick.watch(clickyClasses);
I’m working in version 2 so don’t go to any trouble, unless you think what you learned is readily applicable. I don’t know version 1 so I’m not in any position to say.