Courtesy: GitHub

Assistant on Android TV sample

This sample is designed to run on an Android TV device that supports the assistant (such as the NVIDIA SHIELD). It demonstrates how to interact with the user through the assistant to control playback.

Introduction

Dependencies

The only dependency required is the leanback support library. If you use Android Studio as recommended, the following dependencies will automatically be installed by Gradle.

Getting Started

  • Clone this repo:
git clone https://github.com/googlesamples/leanback-assistant.git
  • Open the project in Android Studio.
  • Compile and deploy to your Android TV device (such as a NVIDIA SHIELD).

Need more information about getting started with Android TV? Check the official docs.

Screenshots

Screenshot

Screenshot

Screenshot

Support

If you need additional help, our community might be able to help.

Contributing

We love contributions! :smile: Please follow the steps in the CONTRIBUTING guide to get started. If you found a bug, please file it here.

License

Licensed under the Apache 2.0 license. See the LICENSE file for details.

compileSdkVersion 26

applicationId "com.example.android.assistantplayback"

minSdkVersion 23

targetSdkVersion 26

versionCode 1

versionName "1.0"

package com.example.android.assistantplayback

uses-permission

  • android.permission.INTERNET

MainActivity

Main entrance into the app, loads {@link MainFragment}.

SearchableActivity

Handles the intent from a global search.
The assistant determines if the content should begin immediately, and lets us know with the boolean extra value, {@link android.support.v4.content.IntentCompat#EXTRA_START_PLAYBACK EXTRA_START_PLAYBACK}. If true, launches {@link PlaybackActivity}, otherwise, launches {@link VideoDetailsActivity}.

PlaybackActivity

Loads {@link PlaybackFragment}.

Builds an activity intent to play a movie. * @param context Used to create an {@link Intent}. @param movieId The id of the movie to play. @return An intent that can be started to play a movie.

VideoDetailsActivity

Loads {@link VideoDetailsFragment}.

VideoContentProvider

Provides global search on the app's movie catalog. The assistant will query this provider for results.
Note: If you provide WatchAction feeds to Google, then you do not need this class. You should still handle the playback intent and media controls in your fragment. This class enables <a href="on-device">https://developer.android.com/training/tv/discovery/searchable.html">on-device search..