AndroidDev AndroidDev - 23 days ago 19
Android Question

Communicating between Android phone and Android TV

Does Android have any built-in communication APIs that lets a native Android app running on a phone communicate with a native Android app running on Android TV? The only solution I can think of is where the Android TV app creates a socket and the client app on the phone would connect to this socket.

EDIT:
I'm looking for a solution where no user interaction is required to setup the communication. Bluetooth requires the user to pair devices. NFC requires being very close to the device.

Answer

Does Android have any built-in communication APIs that lets a native Android app running on a phone communicate with a native Android app running on Android TV?

You have the same options that you with any pair of Android devices:

  • Direct ordinary sockets, if the two devices happen to be on the same WiFi LAN segment or are otherwise directly reachable, and you are comfortable with the security ramifications of having an open socket connection

  • WiFi Direct (where available)

  • Bluetooth

  • Indirect communication through Internet-hosted facilities (e.g., FCM) or possibly some locally-reachable server that is not on the Internet (e.g., WebRTC)

  • NFC, though probably few Android TV devices have NFC support

About the only thing that I can think of that might be more unique for Android TV would be those that offer an infrared (IR) receiver, but I have no idea how much apps can tap into that, and few Android devices have an IR transmitter.

Comments