GuidePublished: 5 min read

ADB Commands for Android TV and Fire TV: Remote Keys, Apps and Power

ADB commands for Android TV, Google TV and Fire TV. D-pad and media keys, typing, opening apps and YouTube links, settings screens, sleep, wake and reboot.

These commands work on Android TV, Google TV and Fire TV once ADB is connected. If you have not connected yet, start with how to control an Android TV with ADB. Every command below is run from your computer. In ADBKit you can paste the part after adb shell into the Shell panel.

Remote control keys

adb shell input keyevent <KEY> presses one button. You can use the name or the number.

Remote buttonKey nameCode
Up / DownKEYCODE_DPAD_UP / KEYCODE_DPAD_DOWN19 / 20
Left / RightKEYCODE_DPAD_LEFT / KEYCODE_DPAD_RIGHT21 / 22
OK (select)KEYCODE_DPAD_CENTER23
BackKEYCODE_BACK4
HomeKEYCODE_HOME3
MenuKEYCODE_MENU82
Search / AssistantKEYCODE_SEARCH84
SettingsKEYCODE_SETTINGS176
Input sourceKEYCODE_TV_INPUT178
Program guideKEYCODE_GUIDE172
Channel up / downKEYCODE_CHANNEL_UP / KEYCODE_CHANNEL_DOWN166 / 167

Several presses in one command are faster than separate commands, because each adb shell call has its own start-up cost:

adb shell input keyevent KEYCODE_DPAD_DOWN KEYCODE_DPAD_DOWN KEYCODE_DPAD_CENTER

Holding a button, for example to open a context menu, uses --longpress:

adb shell input keyevent --longpress KEYCODE_DPAD_CENTER

Volume and media

ActionKey nameCode
Volume up / downKEYCODE_VOLUME_UP / KEYCODE_VOLUME_DOWN24 / 25
MuteKEYCODE_VOLUME_MUTE164
Play / pauseKEYCODE_MEDIA_PLAY_PAUSE85
StopKEYCODE_MEDIA_STOP86
Next / previousKEYCODE_MEDIA_NEXT / KEYCODE_MEDIA_PREVIOUS87 / 88
Rewind / fast forwardKEYCODE_MEDIA_REWIND / KEYCODE_MEDIA_FAST_FORWARD89 / 90
SubtitlesKEYCODE_CAPTIONS175

Whether the TV changes its own speaker volume or the volume of an attached soundbar depends on the model and its HDMI-CEC settings.

Typing text

On-screen TV keyboards are slow with a remote. Focus the text field first, then:

adb shell input text "breaking%sbad"

%s is a space. Characters such as &, ( and ' need escaping for the shell, and input text only types plain ASCII. In ADBKit you can type directly with your keyboard instead, including accented letters. More detail is in ADB input keyevent and text tips.

Opening apps

List the apps you installed yourself:

adb shell pm list packages -3

Open an app by package name. TV apps register a "Leanback" launcher entry, so ask for that category:

adb shell monkey -p com.google.android.youtube.tv -c android.intent.category.LEANBACK_LAUNCHER 1

A few common TV packages:

AppPackage
YouTube for TVcom.google.android.youtube.tv
Netflix (Android TV)com.netflix.ninja
Google Play Storecom.android.vending
Android TV Settingscom.android.tv.settings

Package names can differ by region and by device, so check with pm list packages when one does not open. On Fire TV, Amazon's own apps use com.amazon.* names.

Close an app completely:

adb shell am force-stop com.netflix.ninja
adb shell am start -a android.intent.action.VIEW -d "https://www.youtube.com/watch?v=VIDEO_ID"

If YouTube for TV is installed it opens the video. The same VIEW intent works for other links, as long as some app on the TV handles them. Many TVs have no full web browser, so a plain web page may open nothing.

Settings screens

adb shell am start -a android.settings.SETTINGS
adb shell am start -a android.settings.WIFI_SETTINGS
adb shell am start -a android.settings.APPLICATION_DEVELOPMENT_SETTINGS

Not every TV supports every screen. An error such as "Activity not started, unable to resolve Intent" means that screen is missing on this model.

Sleep, wake, reboot

ActionCommand
Toggle power (like the remote's power button)adb shell input keyevent KEYCODE_POWER
Go to sleepadb shell input keyevent KEYCODE_SLEEP
Wake upadb shell input keyevent KEYCODE_WAKEUP
Is the screen on?adb shell dumpsys power, then look for mWakefulness
Restartadb reboot

Use KEYCODE_SLEEP and KEYCODE_WAKEUP in scripts rather than KEYCODE_POWER, because those two do the same thing every time instead of toggling. Some TVs drop the network connection in deep standby, and then ADB cannot wake them.

Device information

adb shell getprop ro.product.model
adb shell getprop ro.build.version.release
adb shell getprop ro.product.cpu.abilist
adb shell wm size
adb shell df -h /data

ro.product.cpu.abilist matters when you install apps. Many TVs run a 32-bit system even on a 64-bit chip, which is why some APKs refuse to install. See installing APKs on Android TV and Fire TV.

Screenshots

adb exec-out screencap -p > tv.png

Protected streaming video shows black in screenshots and recordings. That is expected, not an error.

Turning preinstalled apps off (carefully)

You can hide a preinstalled app you never use without uninstalling it:

adb shell pm disable-user --user 0 com.example.unwanted
adb shell pm enable com.example.unwanted

The second line undoes the first. Do not disable launchers, system UI, setup or update services. A TV with its home screen disabled can be hard to recover without a factory reset.

For the same commands on phones, see the general ADB commands cheat sheet.