AndroidHardwareInput
| Kind | class |
| Package | android.platform |
| Full name | android.platform.AndroidHardwareInput |
| Source | source/android/platform/AndroidHardwareInput.hx |
Non-standard Android hardware triggers (currently the volume buttons) exposed as bindable game input.
While enabled, KEYCODE_VOLUME_UP/DOWN no longer change the system volume;
they fire onKey instead, letting the engine map them to gameplay
actions. Only enable this in contexts where the user opted in (e.g. a
keybind screen chose volume triggers), and disable it everywhere else so
normal volume control keeps working.
Public fields
| Name | Type | Static | Default | Notes |
|---|---|---|---|---|
KEYCODE_VOLUME_UP | Int | yes | 24 | final · android.view.KeyEvent keycodes for the volume rocker. |
KEYCODE_VOLUME_DOWN | Int | yes | 25 | final |
onKey | FlxTypedSignal<Int->Bool->Void> | yes | — | property (get, never) · Fired for every intercepted hardware key: keyCode, isDown. |
Public methods
enableVolumeKeys
static function enableVolumeKeys():Void
Starts intercepting the volume keys as game input.
disableVolumeKeys
static function disableVolumeKeys():Void
Restores normal system volume key behavior.
areVolumeKeysEnabled
static function areVolumeKeysEnabled():Bool
Internals
Private / internal members
| Field | Type | Static |
|---|---|---|
intercepting | Bool | yes |
_setVolumeKeysIntercepted | Dynamic | yes |
| Method |
|---|
static inline function get_onKey():FlxTypedSignal<Int->Bool->Void> |
static function setVolumeKeysIntercepted_jni(intercept:Bool):Void |