Reading the volume buttons on Android

Previous topic - Next topic

Wampus

Does anyone know how to read the volume buttons on Android?

As far as I have tested the volume buttons (on my Galaxy S2) do nothing to the general sound volume of a GLBasic app. However, I can't read the buttons either. I've tried key(n) up to 255, reading all possible joystick button presses, scanning the mouse button registers and even inkey$ just in case. Nothing is showing up.

I found something about it here.


Minion

Not exactly reading the buttons, but it does control the volume control.

Not sure if this will work on the GS2, but it worked on my Xperia Arc ...

In the folder "...\distribute\Android\src\com\glbasic\test" is a file called SDLActivity.java.

Scroll down until you find //Key Events

Then, for the KeyEvent.ACTION_DOWN change the

return true

to

retrun super.onKeyDown(keyCode, event)

This (should) bring up the standard media volume control when the buttons are pressed (at least it does for me)

Hope it works for you too.

Kitty Hello

You're the best!! Next update will have that change, too.

Wampus

Thanks Minion. :D

Will try that tonight, when I pry the phone from my GF's fingers.

Wampus