A beautiful, production-grade Flutter implementation of the Android TV Remote Control V2 Protocol.
This is a complete, working remote control app for Android TV, Google TV, and Android set-top boxes. It uses the modern V2 Protocol (SSL/TLS + Protocol Buffers), bypassing the deprecated Polo TV protocol.
- 📺 mDNS Discovery: Automatically discovers Android TV devices on your local Wi-Fi network using
_androidtvremote2._tcp. - 🔐 V2 Protocol Handshake: Implements the complex mutual-TLS (mTLS) certificate exchange.
- 🔢 Real Pairing Flow: Extracts public key
modulus/exponentand correctly computes the cryptographic SHA-256 PIN challenge required by modern Google TVs. - ⚡ Protobuf Messaging: Varint-length-delimited Protocol Buffer messages for incredibly fast, low-latency control logic.
- 🎮 Futuristic "Obsidian" UI: A dark, space-themed, highly-responsive user interface using Google Fonts (
Rajdhani) tailored for haptic feedback and smooth animations. - 🎛️ Full Remote Capabilities:
- D-Pad Navigation (Up/Down/Left/Right/OK)
- System Keys (Home, Back, Menu, Input)
- Media Controls (Play, Pause, Stop, Prev, Next)
- Volume Controls (Press or Hold-to-repeat)
- 🛠️ Built-in Mock TV Server: Includes a local Node.js server to simulate an Android TV for debugging protocol logic locally without requiring physical hardware.
(Replace these with actual screenshots from your running app)
- Flutter SDK (3.10.0 or higher)
- A physical Android TV / Google TV on the same Wi-Fi network (or use the mock server)
-
Clone the repository
git clone https://github.com/sebghatyusuf/android_remote.git cd android_remote -
Install Flutter Dependencies
flutter pub get
-
Run the App
flutter run
Older Android TVs used a protocol called Google Polo. Modern TVs (Google TV, Chromecast with Google TV, Nvidia Shield, Prism+) enforce Protocol V2, which is significantly more complex.
This Flutter app implements the entire chain natively:
- Discovery (mDNS): Looks for
_androidtvremote2._tcpon Port 6467. - Mutual TLS: The app generates a persistent RSA-2048 self-signed certificate (
PKCS#8) and forces a secure socket layer over the connection. - The PIN Handshake: When the TV shows a 6-character Hex code (e.g.
A1B2C3), the TV doesn't just check the string. This app automatically pulls the server and client certificate Der keys, extracts the modulus and exponent, appends a binary slice of the PIN, and hashes it usingSHA-256to pass the cryptographic challenge. - Command Protobuf: Once paired, it connects to Port
6466and starts listening toremotePingRequest/remotePingResponseheartbeats while streaming varint-prefixed Protobuf binary data mapped toRemoteKeyInjectcommands.
Don't have a TV nearby? We built a Node.js mock server that simulates an Android TV to debug SSL handshakes, protocol buffer schemas, and cryptographic PIN generation.
# Navigate to the mock server folder
cd mock_tv_server
# Install dependencies
npm install
# Start the mock TV
npm startThe server will publish an mDNS service as "Mock Android TV" and will print a PIN in the terminal when your Flutter app initiates the pairing request.
- bonsoir: mDNS / Zeroconf network discovery.
- flutter_riverpod: Predictable, scalable state management (Scanning -> Pairing -> Connected).
- basic_utils: X.509 Certificate generation and RSA key extraction.
- crypto: Cryptographic hashing for the pairing secret.
- protobuf: Binary message encoding.
- flutter_secure_storage: Securely stores the client certificate and pairing keys.
Contributions are heavily encouraged! If you're looking to dive into reverse-engineering, network protocols, or Flutter UI, check the 'Issues' tab.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
Distributed under the MIT License. See LICENSE for more information.
This project was built through reverse engineering references and prior work done by the open-source community:
- louis49/androidtv-remote (NodeJS Reference)
- tronikos/androidtvremote2 (Python Reference)



