Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Implement and design Android apps for TV

I want to create a TV ready app. Since this is still a quiet new topic I'm asking myself those questions:

  • What do I need to keep in mind for a great TV experience?
  • Can I share code with my TV app?
  • Can I reuse layouts, strings and other resources?

Also, I have problems currently to find helpful resources on the web especially for the Amazon Fire TV. I found many resources which were outdated or have moved and are now death links.

Are there some best practices to implement great apps?

like image 414
rekire Avatar asked Mar 18 '23 03:03

rekire


1 Answers

This answer is still work in progress.


What do I need to keep in mind for a great TV experience?

A good point to start is the Android documentation Building Layouts for TV. The Amazon Design and User Experience Guidelines. At my current point of knowledge I think it should be no problem to mix that resources for both TV platforms.

I would also check this resources:

  • Design Guidelines: Android TV
  • Design Guidelines: Style for TV

Can I share code with my TV app?

You can share all code you currently use. You just need to extend the manifest to make sure that it will been displayed correctly on the TV.

For integration on the Android TV launcher you need to add this category to integrate it:

<category android:name="android.intent.category.LEANBACK_LAUNCHER" />

Read more about that here.

Amazon does it in a quiet other way, right now I'm not familiar with it however it seems that you need to publish your app first to get a launcher integration. But you can always start your app by using the settings and managing apps.


Can I reuse layouts, strings and other resources?

Yes you can. I figured out that you can use the -w960dp suffix to restrict resources to the TV platform. There is no need to create a seperat app to support TVs.


Are there some best practices to implement great apps?

In attention to that suffix I refered above you define differnt resouces for your desired target device type.

So if you use this layout:

<TextView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:text="@string/hello"/>

You can define this resources:

values/strings.xml:

<string name="hello">Hello mobile</string>

values-w600dp/strings.xml:

<string name="hello">Hello tablet</string>

values-w960dp/strings.xml:

<string name="hello">Hello TV</string>

That would produce a correct hello for all platforms (wearable are always a separate project).

like image 195
rekire Avatar answered Apr 01 '23 05:04

rekire