Android Question Change media sound B4A

Hirogens

Active Member
Licensed User
Hello, I would like to change the sound level when I press the 'up' volume bouton from the smartphone. Because when I use my app I can't change the volume level by pressing the button..
 

Emme Developer

Well-Known Member
Licensed User
Hello, I would like to change the sound level when I press the 'up' volume bouton from the smartphone. Because when I use my app I can't change the volume level by pressing the button..
Maybe you are intercepting the volume key using Activity_KeyPress, so your app override the button. You can intercept the button by using sub like this

B4X:
Sub Activity_KeyPress (KeyCode As Int) As Boolean 'Return True to consume the event
    If KeyCode = KeyCodes.KEYCODE_VOLUME_UP Then
        Log("intercepted")
        Return True
    End If
    Return False
End Sub
 
Upvote 0
Top