Skip to content

Instantly share code, notes, and snippets.

@Haaroon
Created December 30, 2021 20:12
Show Gist options
  • Save Haaroon/8055be5d300d06196b2d15c0c6dfd095 to your computer and use it in GitHub Desktop.
Save Haaroon/8055be5d300d06196b2d15c0c6dfd095 to your computer and use it in GitHub Desktop.
How to Remap buttons on your Android TV remote e.g. Google Play and Netflix buttons
Just now·2 min read
Modern TVs are now shipped with Operating Systems like Android TV, which bring about a large step forwards.
Unfortunately, these devices such as the Sony XH950 TV come with old-school remotes, e.g. Sony RMF-TX500E, pictured below. These come with pre-programmed “AD-buttons” that are shortcuts to things like “Google Play” and “Netflix”.
Remote with yucky ad buttons
What if you wanted to change them? Instead of Netflix open up HDMI for my PC, instead of Google Play open up YouTube. Here is a quick barebones guide on how you can. I say barebones, because this guide took me 5 minutes to write and requires that you already have advanced knowledge in Android programming. This is not a step-by-step guide per say.
For this I downloaded the Button Mapper app on the Android TV. https://play.google.com/store/apps/details?id=flar2.homebutton Using this you can easily change the buttons. Just install the app, enable accessibility access and voila. Then add the buttons via the “Add Buttons” Menu and configure your changes. You will need the premium version of this app which is £3.50, nothing considering I use my TV everyday and this is a one-time setup.
However, what if you want it to run thing like “Switch to HDMI 1”. You will have to use a shell command. First enable ADB debugging on your Android TV (great way to play pranks on people), then connect via abd from your laptop and enable the “WRITE_SECURE_SETTINGS” as shown in the button mapper menu.
Once enabled you can now control your TV using keyevents. For example to get the TV to change HDMI input on your computer you can run the command
> adb shell input keyevent 243
In the button mapper settings, simple select advanced, shell and then input
> input keyevent 243
If you are lazy and you dont want to type the command on the remote, make sure the text input is open on the TV and on your PC type
> adb shell “input keyboard text ‘input keyevent 243’”
This will input the text directly into the TV.
A list of all keycodes you can use below. Enjoy.
https://developer.android.com/reference/android/view/KeyEvent.html
https://medium.com/@haaroon/how-to-remap-buttons-on-your-android-tv-remote-e-g-google-play-and-netflix-buttons-632b2af3e66d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment