15 maggio 2024
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 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:
Beta01 makes two big changes from alpha10:
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<Movie?>(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.
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!