Over the past year, we’ve seen significant growth of Android TV OS, reaching 220 million monthly active devices with a 47% year-over-year increase. This incredible engagement would not be possible without our dedicated developer community. A massive thank you for your contributions.

We’re bringing Android 14 to TV! The next generation of Android provides improvements in performance, sustainability, accessibility, and multitasking to help you build engaging apps for TVs.

hasSystemFeature(PackageManager.FEATURE_PICTURE_IN_PICTURE)

For additional details, consult the updated Android TV app quality guidelines and the Android 14 for TV release notes.

Compose for TV

Compose for TV is now available in 1.0.0-beta01. We’ve updated the developer tools in Android Studio to include a new project wizard to give you a running start with Compose for TV.

Here are just a few ways Compose makes it easier to build apps for TV:

    • Dedicated components for TV apps. Explore these components in our design guide or in practice by using our new TV Material Catalog app. Since the previous alpha release, we’ve added lists, navigation, chips, and settings screens.
    • Improved input support and performance. We’ve worked hard to address focus issues and ensure that the UI appears and animates smoothly.
    • Ease of implementation and extensive styling. Add components to your app and customize them with minimal code.
    • Broad form-factor support. Reuse business logic from your phone, tablet, or foldable app to render a TV UI with changes that can be as small as simply adding a ViewModel.

Beta01 makes two big changes from alpha10:

    • Several components have graduated from experimental.
    • The ImmersiveList composable has been removed from the androidx-tv-material package.

Carousel and chip components, such as FilterChip, are still experimental, so you’ll want to keep the @ExperimentalTvMaterial3Api annotation if you are using these components in your app. For all other components, you can now remove the @ExperimentalTvMaterial3Api annotation, since these APIs are now available in beta.

We heard your feedback about the variety in the data types that represent content, which made it difficult to design a component in such a way that it would result in less code. If you are using the ImmersiveList composable from the alpha release, replace it with a custom implementation of an immersive list. While ImmersiveList is no longer part of Compose for TV, you can create an immersive list with just a few lines of code:

@Composable
fun SampleImmersiveList() {
    val selectedMovie = remember { mutableStateOf(null) }


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


        // Rows
        LazyRow(
            modifier = Modifier.align(Alignment.BottomEnd),
            ...
        ) {
            items(movies) { movie ->
                MyMovieCard(
                    modifier = Modifier
                        .onFocusChanged {
                            if (it.hasFocus) {
                                selectedMovie.value = movie
                            }
                        },
                    ...
                ) {}
            }
        }
    }
}

A complete snippet is available in the immersive list sample.

Also consult the comprehensive list of changes in the release notes to migrate any renamed or moved components.

Migrate from the Leanback UI toolkit

We recommend following our step-by-step migration guide to switch from Leanback to Compose for Android TV.

Resources

Whether you’re new to Compose or are in the process of migrating to Compose already, our large collection of resources are here to help you learn best practices for building TV UIs with the modern Android development toolkit, Jetpack Compose:

Engage with the active Android developer community on Stack Overflow for any bugs you encounter, or submit the bugs through our public bug tracker.

Thank you for your continued support of Android TV OS. We can’t wait to see what you’ll do on Google TV with the Android 14 TV OS!



Source link


administrator

Leave a Reply

Your email address will not be published. Required fields are marked *