Android Question Use volum button for something else

joermo

Member
Licensed User
Shalom!

Is it possible to make an app with B4A where the volume button's behaviour is overridden? I would like to listen for short and long press, and then have the app act upon those instructions.
 
Last edited:

ronell

Well-Known Member
Licensed User
Longtime User
B4X:
Sub Activity_KeyPress (KeyCode As Int) As Boolean
    Select KeyCode
        Case KeyCodes.KEYCODE_VOLUME_UP
           
Return True
        Case KeyCodes.KEYCODE_VOLUME_DOWN

Return True          
    End Select
End Sub
dont know if volume long press is possible to intercept
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…