Android Volume Key Event Capture

后端 未结 3 2101
清歌不尽
清歌不尽 2021-02-11 04:36

I am currently developing an app for android..

how i can capture the volume key event when user press in android phone

i am using

3条回答
  •  后悔当初
    2021-02-11 04:41

    As mentioned in Phonegap API Docs, This following code works only in Blackberry:

    document.addEventListener("volumeupbutton", yourCallbackFunction, false);
    document.addEventListener("volumedownbutton", yourCallbackFunction, false);
    

    But there's nothing harm in checking it out. It might work with the latest Phonegap SDK

    hope this helps!

提交回复
热议问题