I am unable to find any API references for building remote apps for Android TV. However, considering there are multiple third party apps on the Play store which can control Android TVs, I was wondering if it is possible to do the same from Linux on Raspberry Pi.
Of course yes. You can connect to Android TV via ADB. Next, send the commands to the ADB mode of the TV.
Connect to the TV:
- Install ADB package on the Raspberry Pi:
sudo apt-get update sudo apt-get install adb
- Turn on ADB on the TV and find the TV's IP address then try to connect as port
5555. Assume that the IP address of the TV is
adb connect 192.168.1.100:5555
- Accept on the TV, a dialog like picture below:
Now, you've connected to the TV and also can run any ADB commands according to your TV brand.
You need to just find ADB commands for changing the channel, input, brightness level, etc as reported by your TV brand's RCKey.
With the help of this link - Darren's AndroidTV Automation Framework, you would be able to change states of the TV as I said above. It will help you enough and you might not need more information.
To find your TV's RCKey, check this link - Hacking an Android TV out.
If you are familiar with java, read this link - Android TV KeyEvent to create your own framework!
Overall, with the help of the ADB connection, you can achieve the goal that you said.