[Android TV General] Double_A_92:
Remapping Android TV remote buttons

​

In this guide I will explain a way to remap to the shortcut buttons on the remotes of Android TV devices which cannot simply be remapped by e.g. Button Mapper.

I will use the Walmart Onn Box as example for this guide, but it should also work for devices like the Xiaomi Mi Box.

The general idea is to install an Android automation app which analyzes the system logs of you device and starts your desired apps when it sees the button press log messages.

Enabling ADB

To install the automation app and give it permissions it needs, you must enable developper mode on your Android TV device and connect to it from your computer.

Those two turorials should explain you how to do it:

https://www.xda-developers.com/how-to-sideload-apps-android-tv​

https://www.xda-developers.com/install-adb-windows-macos-linux​

Easy way to control your Android TV device

Since it is very cumbersome or impossible to do everything with the remote control I recommend to use ScrCpy.

This allows you to easily control your device from your computer using mouse and keyboard.

After installation you can connect to your device with adb and enter 'scrcpy' in your console. You should instantly see the screen of your TV on your computer.

Installing 'Automate'

The app I recommend for the automation is called 'Automate'. It is free, but sadly can't be directly installed from the app store on Android TV (because of compatibility).

To avoid this limitation you can download the APK from e.g. Apkmirror and install it manually via ADB.

While you are at it you can also give the app some privileges which it needs later to read the system logs and to start the apps.

To start Automate you need a launcher that can see sideloaded apps. I recommend the X-plore File Manager since it's also a good file manager and can be easily installed from the app store.

( There are also other alternatives like 'Tasker' instead of 'Automate', but since that is not free and activation doesn't work properly on a sideloaded app I can't recommend that. )

Configuring 'Automate'

After starting Automate you can create a new 'flow'. The goal of that flow is to monitor the system logs, and start your desired apps everytime it sees a button press message.

That can be done mainly with a 'Log await' node that contains following configuration:

You can then use "Expression true?" nodes to check for the found value in keycode (e.g. for the Live TV button) ...

... and start your desired app with "App start" nodes.

An example of a full flow can be found here: 📺🎛️ Remap Onn. Android TV remote buttons

Conclusion

After setting all this up the apps should start when you press the buttons.

However the original app (or its installation view) also starts before it, so if you press the back button you will return to that app instead of the previously running app. To avoid that just use the home button instead.

The Automate app will not automatically start if you reboot your Android TV device. If you want that you can activate that in the settings: 'Run on system startup'. But make sure that everything works perfectly before you do that!

If you get stuck in a loop where you can't use other apps and also can't open and configure Automate anymore, you can use this command via ADB to disable all flows: