I seem to be unable to get the Kindle Fire HD 8.9 (probably other Kindle variants as well) to handle the hardware volume keys properly.
When a Corona app is running and does not use a key event listener at all, the OS volume indicator displays, but the main volume (from the Corona app) does not change.
When non-Corona apps are running, the volume indicator displays and the volume changes as the up/down keys are pressed.
This behavior can be verified by running a Corona app that loops an audio stream and does not have any key event listeners. Other apps (Silk Browser, YouTube, pretty much anything else) allow the OS to handle the volume as expected.
Here is a sample main.lua that exhibits the behavior. You will need to supply your own SampleLoop.mp3 file.
local function playSong() local song = audio.loadStream( "SampleLoop.mp3" ) audio.play( song, { channel=1, loops=-1 } ) print( "playSong: song playing" ) end local function init() -- Runtime:addEventListener( "key", onKeyEvent ) playSong() end init()
console output when run on Kindle Fire HD 8.9:
D/PhoneWindow( 8432): superDispatchKeyEvent. key event has been consumed by the views. keyCode: 25 I/AudioPolicyManagerBase(31231): setStreamVolumeIndex() stream 3, index 18 I/AudioPolicyManagerBase(31231): setStreamVolume() for output 1 stream 3, device 2, volume 2.000000, delay 0 I/AudioPolicyManagerBase(31231): setStreamVolumeIndex() stream 9, index 18 I/AudioPolicyManagerBase(31231): setStreamVolume() for output 1 stream 9, device 2, volume 2.000000, delay 0 I/AudioPolicyManagerBase(31231): setStreamVolumeIndex() stream 2, index 18 I/AudioPolicyManagerBase(31231): setStreamVolume() for output 1 stream 2, device 2, volume 2.000000, delay 0 I/AudioPolicyManagerBase(31231): setStreamVolumeIndex() stream 5, index 18 I/AudioPolicyManagerBase(31231): setStreamVolume() for output 1 stream 5, device 2, volume 2.000000, delay 0 I/AudioFlinger(31231): set smart gain 2 dB D/PhoneWindow( 8432): superDispatchKeyEvent. key event has been consumed by the views. keyCode: 25 I/AudioPolicyManagerBase(31231): startOutput() output 1, stream 5, session 99 I/AudioPolicyManagerBase(31231): stopOutput() output 1, stream 5, session 99 D/PhoneWindow( 8432): superDispatchKeyEvent. key event has been consumed by the views. keyCode: 25 I/AudioPolicyManagerBase(31231): setStreamVolumeIndex() stream 2, index 17 I/AudioPolicyManagerBase(31231): setStreamVolume() for output 1 stream 2, device 2, volume 0.000000, delay 0 I/AudioPolicyManagerBase(31231): setStreamVolumeIndex() stream 5, index 17 I/AudioPolicyManagerBase(31231): setStreamVolume() for output 1 stream 5, device 2, volume 0.000000, delay 0 D/PhoneWindow( 8432): superDispatchKeyEvent. key event has been consumed by the views. keyCode: 25 I/AudioPolicyManagerBase(31231): startOutput() output 1, stream 5, session 99