Volume Up/Down Buttons

While i play my game volume up/down buttons are like dead.

In every other game works perfect so my device is not broken :stuck_out_tongue:

For sure im missing something easy here but what???

Some help plz!

I use audio library if that matters.

Thank you

Are you building for Android or iOS?

For iOS, there is no volume controls.  The OS handles it.  Android should handle it too for you, however we do support reading the buttons, but your app has to code for it.

See this blog post:

http://www.coronalabs.com/blog/2013/03/26/androidizing-your-mobile-app/

Scroll down to the Key handling section and that should get you all set to go.

Hi Rob

Im building for Android and iOS too but i have that issue only on my android device.

Maybe it’s my device (an old samsung galaxy s i9000, 2.2ver) but handling the keys through code will do the trick.Basically i do it already for back and menu key.

Thank you!!

It didnt work!

Any suggestions??

did you put in some print statements and look at the console log to make sure they are being fired correctly?

No I didn’t.One question though. Simulator has volume up/down buttons or do you mean debugging on android device?

Sorry this is the account I want to use from now on :smiley: Just have so many devices and Mac and forgot to change all of them!

The corona simulator does not have volume buttons to simulate.  You can only do this on device. 

If you are handling key events, then make sure to return “false” for keys that you are not handling, such as the volume keys.  If you return true for the volume keys, then you are telling the operating system that your app will handle the volume keys instead and you’ll lose the default handling.  You can test that this is the root cause by commenting out your key event listener.

Rob and Joshua thank you.

Works like a charm now!

Are you building for Android or iOS?

For iOS, there is no volume controls.  The OS handles it.  Android should handle it too for you, however we do support reading the buttons, but your app has to code for it.

See this blog post:

http://www.coronalabs.com/blog/2013/03/26/androidizing-your-mobile-app/

Scroll down to the Key handling section and that should get you all set to go.

Hi Rob

Im building for Android and iOS too but i have that issue only on my android device.

Maybe it’s my device (an old samsung galaxy s i9000, 2.2ver) but handling the keys through code will do the trick.Basically i do it already for back and menu key.

Thank you!!

It didnt work!

Any suggestions??

did you put in some print statements and look at the console log to make sure they are being fired correctly?

No I didn’t.One question though. Simulator has volume up/down buttons or do you mean debugging on android device?

Sorry this is the account I want to use from now on :smiley: Just have so many devices and Mac and forgot to change all of them!

The corona simulator does not have volume buttons to simulate.  You can only do this on device. 

If you are handling key events, then make sure to return “false” for keys that you are not handling, such as the volume keys.  If you return true for the volume keys, then you are telling the operating system that your app will handle the volume keys instead and you’ll lose the default handling.  You can test that this is the root cause by commenting out your key event listener.

Rob and Joshua thank you.

Works like a charm now!