13.9 C
London
Thursday, May 16, 2024

The whole lot you might want to learn about Google TV and Android TV OS


Over the previous yr, we’ve seen vital development of Android TV OS, reaching 220 million month-to-month lively units with a 47% year-over-year enhance. This unimaginable engagement wouldn’t be attainable with out our devoted developer neighborhood. An enormous thanks on your contributions.

We’re bringing Android 14 to TV! The following era of Android supplies enhancements in efficiency, sustainability, accessibility, and multitasking that can assist you construct partaking apps for TVs.

hasSystemFeature(PackageManager.FEATURE_PICTURE_IN_PICTURE)

For extra particulars, seek the advice of the up to date Android TV app high quality pointers and the Android 14 for TV launch notes.

Compose for TV

Compose for TV is now out there in 1.0.0-beta01. We’ve up to date the developer instruments in Android Studio to incorporate a brand new venture wizard to provide you a working begin with Compose for TV.

Listed here are only a few methods Compose makes it simpler to construct apps for TV:

    • Devoted parts for TV apps. Discover these parts in our design information or in apply through the use of our new TV Materials Catalog app. For the reason that earlier alpha launch, we’ve added lists, navigation, chips, and settings screens.
    • Improved enter help and efficiency. We’ve labored arduous to handle focus points and be sure that the UI seems and animates easily.
    • Ease of implementation and intensive styling. Add parts to your app and customise them with minimal code.
    • Broad form-factor help. Reuse enterprise logic out of your cellphone, pill, or foldable app to render a TV UI with modifications that may be as small as merely including a ViewModel.

Beta01 makes two large modifications from alpha10:

    • A number of parts have graduated from experimental.
    • The ImmersiveList composable has been faraway from the androidx-tv-material bundle.

Carousel and chip parts, akin to FilterChip, are nonetheless experimental, so that you’ll wish to preserve the @ExperimentalTvMaterial3Api annotation if you’re utilizing these parts in your app. For all different parts, now you can take away the @ExperimentalTvMaterial3Api annotation, since these APIs are actually out there in beta.

We heard your suggestions in regards to the selection within the information sorts that signify content material, which made it troublesome to design a part in such a approach that it might lead to much less code. If you’re utilizing the ImmersiveList composable from the alpha launch, exchange it with a customized implementation of an immersive checklist. Whereas ImmersiveList is not a part of Compose for TV, you possibly can create an immersive checklist with only a few traces of code:

@Composable
enjoyable SampleImmersiveList() {
    val selectedMovie = keep in mind { mutableStateOf<Film?>(null) }


    // Container
    Field(
        modifier = Modifier
            .fillMaxWidth()
            .peak(400.dp)
    ) {
        // Background
        Field(
            modifier = Modifier
                .fillMaxWidth()
                .aspectRatio(20f / 7)
                .background(selectedMovie.background)
        ) {}


        // Rows
        LazyRow(
            modifier = Modifier.align(Alignment.BottomEnd),
            ...
        ) {
            gadgets(motion pictures) { film ->
                MyMovieCard(
                    modifier = Modifier
                        .onFocusChanged {
                            if (it.hasFocus) {
                                selectedMovie.worth = film
                            }
                        },
                    ...
                ) {}
            }
        }
    }
}

A whole snippet is on the market within the immersive checklist pattern.

Additionally seek the advice of the excellent checklist of modifications within the launch notes emigrate any renamed or moved parts.

Migrate from the Leanback UI toolkit

We suggest following our step-by-step migration information to change from Leanback to Compose for Android TV.

Assets

Whether or not you’re new to Compose or are within the means of migrating to Compose already, our giant assortment of sources are right here that can assist you be taught greatest practices for constructing TV UIs with the trendy Android growth toolkit, Jetpack Compose:

Have interaction with the lively Android developer neighborhood on Stack Overflow for any bugs you encounter, or submit the bugs via our public bug tracker.

Thanks on your continued help of Android TV OS. We will’t wait to see what you’ll do on Google TV with the Android 14 TV OS!

Latest news
Related news

LEAVE A REPLY

Please enter your comment!
Please enter your name here