Share
Embed
Developing for the Big Screen - from Android TV to Chromecast - DevFest Istanbul 2014
With the new release of Lollipop we have finally an updated API Level for Google TV, oops Android TV. This is not the only approach by Google for the large screen. There is also the Chromecast, a HDMI dongle/ media player. This Session gives an introduction how you can develop for Android TV and the ChromeCast. It presents the tools and also the support library for creating own Screens, based on an example application.
Hasan Hosgel
December 06, 2014
Transcript
106 slides
-
www.immobilienscout24.de Developing for the Big Screen - from Android TV
to Chromecast DevFest Istanbul 2014 | 06.12.2014 | Hasan Hosgel -
About me +HasanHosgel @alosdev alosdev hosgel CO- Organizer Developer Developing
for the Big Screen | Hasan Hosgel -
About ImmobilienScout24 Germany’s largest real estate listing company. > 10.5
Mio. Monthly unique users > 1.5 Mio. real estates > 300 Mio. detail views > 1500 Servers ~ 8.5 Mio. App downloads ~ 4.5 Mio. Android > 55% mobile traffic Developing for the Big Screen | Hasan Hosgel -
Once upon a time Developing for the Big Screen |
Hasan Hosgel Image Source https://www.flickr.com/photos/theinfamousgdub/1765952198 -
Has time to create something new Developing for the Big
Screen | Hasan Hosgel Image Source https://www.flickr.com/photos/slworking/8095803230 -
While sitting in the living room… Developing for the Big
Screen | Hasan Hosgel Image Source http://upload.wikimedia.org/wikipedia/commons/4/4c/Children_watching_TV.jpg -
Before we start programming Developing for the Big Screen |
Hasan Hosgel Image Source https://www.flickr.com/photos/pgautier/166610944 -
Prerequisite •casual consumption - not focused like on phone Developing
for the Big Screen | Hasan Hosgel -
Prerequisite •casual consumption - not focused like on phone •cinematic
experience - 3 meter away Developing for the Big Screen | Hasan Hosgel -
Prerequisite •casual consumption - not focused like on phone •cinematic
experience - 3 meter away •Simplicity - no touchpad Developing for the Big Screen | Hasan Hosgel -
Navigation •Home •Enter Button •Back •D-Pad in two axis Developing
for the Big Screen | Hasan Hosgel -
Navigation •use appropriate states for better recognotion of focus/ selection
Developing for the Big Screen | Hasan Hosgel -
Navigation •use appropriate states for better recognotion of focus/ selection
•use sound – occasionally Developing for the Big Screen | Hasan Hosgel -
Navigation •use appropriate states for better recognotion of focus/ selection
•use sound – occasionally •use next focus targets - for defining own navigation flow Developing for the Big Screen | Hasan Hosgel -
Navigation •use appropriate states for better recognotion of focus/ selection
•use sound – occasionally •use next focus targets - for defining own navigation flow Test it properly Developing for the Big Screen | Hasan Hosgel -
Start Developing for the Big Screen | Hasan Hosgel Image
Source https://www.flickr.com/photos/thevancats/422670456 -
Needed libraries •v17 leanback support library Developing for the Big
Screen | Hasan Hosgel -
Needed libraries •v17 leanback support library •v7 recyclerview support library
Developing for the Big Screen | Hasan Hosgel -
Needed libraries •v17 leanback support library •v7 recyclerview support library
•v7 cardview support library Developing for the Big Screen | Hasan Hosgel -
Needed libraries •v17 leanback support library •v7 recyclerview support library
•v7 cardview support library Forces you to use also •v4 support library Developing for the Big Screen | Hasan Hosgel -
AndroidManifest.xml changes <manifest ...> ... ... </manifest> Developing for the
Big Screen | Hasan Hosgel -
AndroidManifest.xml changes <manifest ...> ... <uses-feature android:name="android.hardware.touchscreen" android:required="false" /> ...
</manifest> Developing for the Big Screen | Hasan Hosgel -
AndroidManifest.xml changes <manifest ...> ... <uses-feature android:name="android.hardware.touchscreen" android:required="false" /> ...
</manifest> Developing for the Big Screen | Hasan Hosgel -
AndroidManifest.xml changes <manifest ...> ... <uses-feature android:name="android.hardware.touchscreen" android:required="false" /> ...
</manifest> Developing for the Big Screen | Hasan Hosgel -
AndroidManifest.xml changes <manifest ...> ... <uses-feature android:name="android.hardware.touchscreen" android:required="false" /> ...
</manifest> Developing for the Big Screen | Hasan Hosgel -
AndroidManifest.xml changes <manifest ...> ... <uses-feature android:name="android.hardware.touchscreen" android:required="false" /> <uses-feature
android:name="android.software.leanback" android:required="true" /> ... </manifest> Developing for the Big Screen | Hasan Hosgel -
AndroidManifest.xml changes <manifest ...> ... <uses-feature android:name="android.hardware.touchscreen" android:required="false" /> <uses-feature
android:name="android.software.leanback" android:required="true" /> ... </manifest> Developing for the Big Screen | Hasan Hosgel -
AndroidManifest.xml changes <manifest ...> ... <uses-feature android:name="android.hardware.touchscreen" android:required="false" /> <uses-feature
android:name="android.software.leanback" android:required="true" /> ... </manifest> Developing for the Big Screen | Hasan Hosgel -
AndroidManifest.xml changes <manifest ...> ... <uses-feature android:name="android.hardware.touchscreen" android:required="false" /> <uses-feature
android:name="android.software.leanback" android:required="true" /> ... </manifest> Developing for the Big Screen | Hasan Hosgel -
AndroidManifest.xml application changes <application android:banner="@drawable/banner" > ... <activity android:name="com.example.android.TvActivity“ android:theme="@style/Theme.Leanback">
</activity> </application> Developing for the Big Screen | Hasan Hosgel -
AndroidManifest.xml application changes <application android:banner="@drawable/banner" > ... <activity android:name="com.example.android.TvActivity“ android:theme="@style/Theme.Leanback">
</activity> </application> Developing for the Big Screen | Hasan Hosgel -
AndroidManifest.xml application changes <application android:banner="@drawable/banner" > ... <activity android:name="com.example.android.TvActivity“ android:theme="@style/Theme.Leanback">
<intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LEANBACK_LAUNCHER" /> </intent-filter> </activity> </application> Developing for the Big Screen | Hasan Hosgel -
AndroidManifest.xml application changes <application android:banner="@drawable/banner" > ... <activity android:name="com.example.android.TvActivity“ android:theme="@style/Theme.Leanback">
<intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LEANBACK_LAUNCHER" /> </intent-filter> </activity> </application> Developing for the Big Screen | Hasan Hosgel -
avoid filtering in Playstore set the attribute “required” to “false”
in AndroidManifest Developing for the Big Screen | Hasan Hosgel -
avoid filtering in Playstore set the attribute “required” to “false”
in AndroidManifest If you don’t to this, the application cannot be found on the play store for TV Developing for the Big Screen | Hasan Hosgel -
Recognize TV programmatically UiModeManager uiModeManager = (UiModeManager) getSystemService(UI_MODE_SERVICE); if (uiModeManager.getCurrentModeType()
== Configuration.UI_MODE_TYPE_TELEVISION) { Log.d(TAG, "Running on a TV Device") } else { Log.d(TAG, "Running on a non-TV Device") } Developing for the Big Screen | Hasan Hosgel -
Recognize TV programmatically UiModeManager uiModeManager = (UiModeManager) getSystemService(UI_MODE_SERVICE); if (uiModeManager.getCurrentModeType()
== Configuration.UI_MODE_TYPE_TELEVISION) { Log.d(TAG, "Running on a TV Device") } else { Log.d(TAG, "Running on a non-TV Device") } Developing for the Big Screen | Hasan Hosgel -
Avoid Layout Anti-Patterns •Reuse of phone or tablet layout Developing
for the Big Screen | Hasan Hosgel -
Avoid Layout Anti-Patterns •Reuse of phone or tablet layout •Usage
of ActionBar Developing for the Big Screen | Hasan Hosgel -
Avoid Layout Anti-Patterns •Reuse of phone or tablet layout •Usage
of ActionBar •Usage of ViewPager Developing for the Big Screen | Hasan Hosgel -
Let’s take a deeper look at the used Design Pattern
Developing for the Big Screen | Hasan Hosgel Image Source https://www.flickr.com/photos/dsittig/12311006886 -
Model View Constroller vs. Model View Presenter Developing for the
Big Screen | Hasan Hosgel Source: http://i.imgur.com/xbeB5.png -
Model View Constroller vs. Model View Presenter Developing for the
Big Screen | Hasan Hosgel Source: http://i.imgur.com/xbeB5.png -
Browse Fragment Developing for the Big Screen | Hasan Hosgel
Source: https://github.com/googlesamples/androidtv-Leanback/ -
Browse Fragment Developing for the Big Screen | Hasan Hosgel
Source: https://github.com/googlesamples/androidtv-Leanback/ -
Detail Fragment Developing for the Big Screen | Hasan Hosgel
Source: https://github.com/googlesamples/androidtv-Leanback/ -
Detail Fragment Developing for the Big Screen | Hasan Hosgel
Source: https://github.com/googlesamples/androidtv-Leanback/ -
Some Base Classes •BrowseFragment •DetailFragment •SearchFragment Developing for the Big
Screen | Hasan Hosgel -
Search Fragment Developing for the Big Screen | Hasan Hosgel
Source: https://github.com/googlesamples/androidtv-Leanback/ -
Some Base Classes •BrowseFragment •DetailFragment •SearchFragment •Recommendations (no base class)
Developing for the Big Screen | Hasan Hosgel -
Recommendation Developing for the Big Screen | Hasan Hosgel Source:
https://github.com/googlesamples/androidtv-Leanback/ -
Some days later a friend sends a message Developing for
the Big Screen | Hasan Hosgel Image Source https://www.flickr.com/photos/jparise/214330120 -
Chromecast Developing for the Big Screen | Hasan Hosgel Image
Source http://www.google.de/intl/de/chrome/devices/chromecast/ -
Chromecast Developing for the Big Screen | Hasan Hosgel Image
Source http://www.google.de/intl/de/chrome/devices/chromecast/ -
Starting the conversation Developing for the Big Screen | Hasan
Hosgel Image Source http://pixabay.com/de/katze-hauskate-tier-augen-blick-278187/ -
You can conquer a new world Developing for the Big
Screen | Hasan Hosgel Image Source http://pixabay.com/de/katze-wand-loch-überraschung-alt-491730/ -
Developing for Chomecast •Registration (cost 5$) Developing for the Big
Screen | Hasan Hosgel -
Developing for Chomecast •Registration (cost 5$) Register application and developer
devices Developing for the Big Screen | Hasan Hosgel -
You can conquer a new world Developing for the Big
Screen | Hasan Hosgel -
Developing for Chomecast •Registration (cost 5$) Register application and developer
devices •Create sender app Android, IOs, Chrome Developing for the Big Screen | Hasan Hosgel -
Needed libraries •v7 appcompat support library Developing for the Big
Screen | Hasan Hosgel -
Needed libraries •v7 appcompat support library •v7 mediarouter support library
Developing for the Big Screen | Hasan Hosgel -
Needed libraries •v7 appcompat support library •v7 mediarouter support library
•google play services library Developing for the Big Screen | Hasan Hosgel -
Needed libraries •v7 appcompat support library •v7 mediarouter support library
•google play services library Forces you to use also Developing for the Big Screen | Hasan Hosgel -
Needed libraries •v7 appcompat support library •v7 mediarouter support library
•google play services library Forces you to use also •v4 support library Developing for the Big Screen | Hasan Hosgel -
Developing for Chomecast •Registration (cost 5$) Register application and developer
devices •Create sender application Android, IOs, Chrome •Create receiver application HTML Developing for the Big Screen | Hasan Hosgel -
Users complaining: they can’t use it on Chromecast! Developing for
the Big Screen | Hasan Hosgel Image Source http://pixabay.com/de/baby-tränen-kleinkind-traurig-443393/ -
After you understand the problem Developing for the Big Screen
| Hasan Hosgel Image Source http://pixabay.com/de/darstellung-porträt-schreien-schrei-89189/ -
Presenation API •In Android API Level 17 support for secondary
screen was added Developing for the Big Screen | Hasan Hosgel -
Presenation API •In Android API Level 17 support for secondary
screen was added Android Mirroring can display different Uis for device and what is displayed ChromeCast Developing for the Big Screen | Hasan Hosgel -
Presenation API •In Android API Level 17 support for secondary
screen was added Android Mirroring can display different Uis for device and what is displayed ChromeCast Similar to MiraCast Developing for the Big Screen | Hasan Hosgel -
Now we can rule the world! Developing for the Big
Screen | Hasan Hosgel Image Source http://www.bhmpics.com/success_kid-wallpapers.html -
www.immobilienscout24.de Thanks for your Attention! İlginiz için teşekkürler! Contact: +HasanHosgel
Twitter: @alosdev Github: alosdev Developing for the Big Screen - from Android TV to Chromecast https://de.slideshare.net/hosgel/dev-fest-istanbul2014developingforthebig- screenfromandroidtvtochromecast -
material • AndroidTV http://developer.android.com/training/tv/ https://github.com/googlesamples/androidtv-Leanback • ChromeCast https://developers.google.com/cast/ https://github.com/googlecast •
Presentation API http://developer.android.com/reference/android/app/Pres entation.html https://github.com/googlecast/CastPresentation-android Developing for the Big Screen | Hasan Hosgel