Get device volume button click action
Application Type
Mobile
Service Studio Version
11.11.14 (Build 48084)

Hi,

I am developing a mobile app and I have the requirement to detect when the user click on the device volume buttons.

How can I detect it? There are any forge component to help me or I need to do this with javascript?


Thanks

Hi Pedro,

I don't know if exist any forge component, but just found this cordova plugin that can detect if you press one of those buttons.

https://github.com/manueldeveloper/cordova-plugin-volume-buttons

Thank you for you feedback, but this plugin don't have implementation for iOS and I need it to iOS Devices.

Hi Pedro,

You can use OnKeyDown or OnKeyPress events placed in below screenshot. You have to add JavaScript (javascript screenshot added) for that handler also.. 

Sample OML attached.. Good luck!!

Thanks, Aadhavan S

eSpacev4.oml

Refer this post also..

Thanks for you feedback, but this don't solve my problem. In my screen I don't any form element. Only an image.

So, do you know how I can detect the volume buttons when I press it?

For detecting only we have to use above mentioned JavaScript. Can you let me know what action you are going to perform once the button was pressed? For the example, alert("Volume button pressed"); 


I have a custom made media player that is muted depends the user options and I want to unmute if the user press the device volume buttons.

In you example you have the javascript inside the Input_Var1OnKeydown that is assigned to the Input_Var1 widget.

I want to detect the button press in the screen instead the widget.

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