November 11, 2013

Developing Second Screen Apps for Google TV part iii

While we extensively covered how to develop Android apps for Google TV in the second part of this blog series, this third and final post will discuss second screen apps for Google TV and how they can add more functionality to existing Google TV apps.

The following images will clearly reflect how today’s user is interacting with Google TV using Android devices. The user can use their Android devices as remote controls and to access functionalities of Google TV applications. This concept is called second screen technology, a smart solution gaining popularity in the Smart TV world. By second screen, we mean an additional electronic device that allows a user to interact with content that they are consuming on their television.

Google TV applications
The apps provide additional content, engage social streams and provide new mediums for advertising and merchandising. The major objective is to make users active participants in a live TV setup and to enhance the User Experience.

Use Cases

  1. Synchronization of content being viewed on mobile device.
  2. Broadcasting live comments over content.
  3. Using mobile device as game controller to play games on television.
  4. Sending live stats, votes for a chat show
  5. Apps that can extend the existing content on television.

Example of Real Apps

  • YouTube Remote application: The YouTube remote application is an intuitive addition to your Google TV experience. By using this app you can activate your Android smartphone or tablet device as a remote and control YouTube videos on desktop and/or Internet TV.
  • Google TV Remote application: Equipped with voice search functionality, you can use the Google TV remote application to share videos and web pages with the TV and even use your voice to search for content.

Communication Workflow

Communication Workflow
The remote application on mobile devices communicates with Google TV in three phases:

Discovery Phase

When Google TV starts, the Anymote service starts sending mDNS broadcast. The broadcast contains the IP address and port number of the remote device. On parsing the response, we get the GoogleTV device name, IP address and port number. The library displays a list of available Google devices extracted from response to the user.

Authentication Phase

The pairing service which runs in parallel authenticates remote devices and establishes a pairing session. The identity is established using the pairing protocol. In the pairing process, the client contacts the server, and the server issues an alphanumeric code for the user to enter on the client device's keyboard.

Proper challenges can be established when the client sends the challenge to the server. The server in turn receives the challenge, creates it and turns it back to the client to respond.

If pairing succeeds, it sends a certificate to the remote application. The certificate should be stored for subsequent connection attempts with Anymote service.

Sending Events to Google TV

The Anymote protocol sends a request message containing event request like keyevents, mouse events. The Anymote Service responds with a ResponseMessage. All Google TV devices implement the Anymote service, which can receive and respond to Anymote protocol messages.

It requires remote devices i.e smartphones or tablets to connect using TLS/SSL, which protects user keystrokes from being recorded by apps or devices sniffing on the same local network. The encryption prevents the leakage of secret information such as usernames, passwords, etc.

The Anymote messages are in protocol buffers format, a platform-independent mechanism for serializing structured data. The protocol make client apps as customized controllers for Google TV apps and can also help you to extend the functionality of existing apps.

Sending Intents to Google TV

A Google TV application like YouTube is launched using the anymote service received from a remote application.

final Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("<video_id>");
anymoteSender.sendUrl (intent.toUri(Intent.URI_INTENT_SCHEME));


We believe that second screen apps will play a huge role in the future of television. In addition, they are more accessible and can be used by anyone with ease. It acts as an additional viewport for the user and can engage users with social feeds of information. Two real-life examples of this would be Twitter and Facebook feeds coming from your friends and any discussion forums on a particular subject.

This final post concludes my effort to share experiences on Google TV application development world from a developer’s perspective. If you liked this 3-part series or have any questions or feedback for me, I will be happy to reply to these. Please leave your comments below.