Skip to content

Android Key Codes Guide

AndroidKeyCode Common Keys

The SDK provides a complete Android key code enum. Common keys are listed below:

System Keys

KeyConstant NameValueDescription
HomeAndroidHome3Home key
BackAndroidBack4Back key
MultitaskAndroidAppSwitch187Multitask/menu key

Volume Control

KeyConstant NameValue
Volume UpVolumeUp24
Volume DownVolumeDown25
MuteVolumeMute164

Power Key

KeyConstant NameValue
PowerPower26

Direction Keys

KeyConstant NameValue
UpArrowUp19
DownArrowDown20
LeftArrowLeft21
RightArrowRight22

Common Input Keys

KeyConstant NameValue
EnterEnter66
BackspaceBackspace67
SpaceSpace62
TabTab61

Letter Keys

KeyConstant NameValue
AKeyA29
BKeyB30
.........
ZKeyZ54

Number Keys

KeyConstant NameValue
0Digit07
1Digit18
.........
9Digit916

For the complete list, please refer to the TypeScript type definitions.

AndroidKeyEventAction

Key action enum.

ActionConstant NameValueDescription
PressDown0Key pressed
ReleaseUp1Key released

Usage Example:

typescript
import { AndroidKeyCode, AndroidKeyEventAction } from "@vmosedge/web-sdk";

// Press Power key
client.sendKeyCode(AndroidKeyCode.Power, AndroidKeyEventAction.Down);
// Release Power key
client.sendKeyCode(AndroidKeyCode.Power, AndroidKeyEventAction.Up);

AndroidMetaState

Meta key state enum (for modifier keys).

StateConstant NameValueDescription
NoneNone0No modifier keys
ShiftShiftOn0x01Shift key pressed
CtrlCtrlOn0x1000Ctrl key pressed
AltAltOn0x02Alt key pressed
MetaMetaOn0x10000Meta key pressed

Usage Example:

typescript
import {
  AndroidKeyCode,
  AndroidKeyEventAction,
  AndroidMetaState,
} from "@vmosedge/web-sdk";

// Ctrl+C (copy)
client.sendKeyCode(
  AndroidKeyCode.KeyC,
  AndroidKeyEventAction.Down,
  AndroidMetaState.CtrlOn
);
client.sendKeyCode(
  AndroidKeyCode.KeyC,
  AndroidKeyEventAction.Up,
  AndroidMetaState.CtrlOn
);

Powered by VMOS Edge Team