Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Intro to Android TV

khangtoh
October 27, 2016

Intro to Android TV

Come and learn how to develop your first Android TV app for Android TV.
Speaker: Khang Toh - CTO @ PicoCandy

khangtoh

October 27, 2016
Tweet

More Decks by khangtoh

Other Decks in Programming

Transcript

  1. Google Play Single or Separate APK Smart TV market 2

    Android 5.0 Based on Lollipop … Android 7.0 Recording API Form Factors Built-in TV , STBs Android TV = Android Opportunities Games Video Streaming Content Experience Shopping Existing TV Devices ~1.8 Billion +100 to 200M connected TVs Announced in 2014 Google I/O Install Base Millions of devices (Google I/O 2016) 100s of models
  2. h"p://www.slideshare.net/gdgkorea/introduce-android-tv-and-new-features-from-google-io-2016 Android TV Activations * Source - According to GDG

    Korea http://www.slideshare.net/gdgkorea/introduce-android-tv-and-new-features-from-google-io-2016 Looks like it growing* Q1 2015 Q4 2015 Q2 2016
  3. Lollipop 2014 First introduction TIF – TV Input Framework Leanback

    support library Marshmallow 2015 Polished based on partner and developer feedback Recommendations API V17 Leanback support library update Brief history of Android TV Nougat 2016 Added advanced API Recents Picture in Picture Recording V17 Leanback library update
  4. Building a great Android TV app 6 Take advantage of

    pre-built fragments for browsing and interacting with media catalogs Build for TV Help users find your content quickly with in-app searching. Make search easy Suggest content from your app to keep your users coming back. Recommendations Help users find your content quickly with in-app searching using VOICE.
  5. Vineyard – OSS TV app Vine Client for Android TV

    —  Implements most of the current features of Leanback —  Adopts Model-View-Presenter approach —  Full source on Github https://github.com/hitherejoe/Vineyard —  Unit and User Interface Tests
  6. Build for TV – The basics Prepping your app — 

    Integrate TV-specific assets —  Add a TV-compatible activity that receives Leanback intent —  Support non-touchscreen input —  Leverage Leanback Support Library
  7. Build for TV – Resource 9 TV app drawable –

    Homescreen banner <application android:name=".VineyardApplication" android:banner="@drawable/banner” Size:160x90dp->320x180pxindrawable-xhdpi
  8. Build for TV – Leanback Launcher 10 TV Activity and

    the launcher <activity android:name=".TvMainActivity" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LEANBACK_LAUNCHER" /> </intent-filter> </activity>
  9. Non-touchscreen input 11 <manifest> <uses-feature android:name="android.hardware.touchscreen" android:required="false" /> ... </manifest>

    Applications that are intended to run on TV devices do not rely on touch screens for input
  10. Non-touchscreen input 12 android:focusable="true”, android:nextFocusDown="@+id/whatever1" android:nextFocusUp="@id/whatever2" <Button ...> <requestFocus />

    </Button> Supporting input – Dpad navigation //Custom view listens to events KeyEvent.KEYCODE_DPAD_(UP|DOWN|LEFT|RIGHT|CENTER)
  11. Leanback Support Library Provides APIs to support building user interfaces

    on TV devices. It provides a number of important widgets (Fragments) for TV apps. Playback Overlay Display playback controls 13 GuidedStep Guide user through series of decisions \ Search Search and display results Grid Display videos in Vertical or horizontal grid Browse Display browse- able categories Details Leanback details screens android.support.v17.leanback <uses-feature android:name="android.software.leanback" android:required="true" /> // android:required=“false” // app that runs on mobile (phones, wearables, tablets, etc.)
  12. Browse Fragment Display browse-able categories, post and option cards setSearchAffordanceColor()

    setOnSearchClicked Listener() setBrandColor() BackgroundManager.getInstance() .setDrawable() setTitle() setBadgeDrawable() setOnItemViewSelectedListener() setOnItemViewClickedListener()
  13. Search Fragment Allows searching of Vine posts by tag or

    username Configure search suggestions using res/xml/ searchable.xml android:searchSuggestAutho rity namespace of content provider Implement a Content Provider 1 2 3 Implement Activity to handle ACTION_SEARCH intent 4
  14. Grid Fragment Post Grid Fragment is used to show a

    grid of videos Launched when a hashtag/ username result is clicked in the Search Fragment
  15. Recommendation Service Recommends API allows you to show your content

    outside of your app ( HomeScreen ) Recommendation Row is a high-visibility area on the Home screen where users can find fresh content. Extend IntentService and Use NotificationCompat.Builder.build (). Notification notification = New NotificationCompat .BigPictureStyle( new NotificationCompat .Builder(mContext) .setContentTitle(mTitle) ... .setExtras(extras)).build(); Bundle extras = new Bundle(); extras.putString(Notification.EXTRA_BACK GROUND_IMAGE_URI, backgroundUri); 1 2 3