Author Archives: Android Developers

Announcing the new guide to Android app modularization

Posted by Miłosz Moczkowski, Developer Relations Engineer, Android

As your app grows in size and complexity, it becomes increasingly difficult to manage, build and scale. One way to address this challenge is a software technique called modular programming, or modularization in short. It’s a practice of organizing a codebase into loosely coupled and independent entities - modules.

We know that modularization has been a hot topic among the Android developers community for quite some time now. Recently, we ran a survey to ask you about your experiences in this topic. 86% of developers said that they work on multi-module codebases regularly, while over 90% stated that modularization is a practice they would recommend considering.

All large apps are fundamentally modular, and at Google, we’ve been utilizing modularization to develop our most popular applications such as YouTube, Play Store or Google News. This is what Google News team has to say about this practice:

“Modularity of code is critical to managing complexity, stability, readability, and testability in an ever-growing codebase.”

On the other hand though, over 54% responders mentioned that it’s difficult to find good learning materials on this topic and almost 95% claimed that currently available materials on developer.android.com are insufficient! In response to this popular demand, we’ve launched the guide to Android app modularization. The guide is split into two parts. The overview page gives you a high level, theoretical overview of the matter and addresses the following questions:
  • What is modularization?
  • What are the benefits of modularizing my codebase?
  • What are the things to watch out for when modularizing?
  • Is modularization the right technique for you?
The common modularization patterns page dives deep into practical examples in the context of the modern Android architecture and gives answer to the these problems:
  • What is the low coupling & high cohesion principle?
  • What are the types of modules and their roles?
  • How do modules pass data between each other?

To see modularization in action, check out the Now in Android project. It's a fully functional app which has a multi-module codebase, and there's a handy modularization learning journey which outlines what the modules do and how they communicate with each other.

Is this for you?


This modularization guide is targeted to intermediate and advanced developers. The guide focuses on modularization from a software architecture point of view. If you’re a beginner, only starting your Android developer journey, you should familiarize yourself with our guide to app architecture first. Modularization guide assumes you are familiar with our recommended app architecture.

It’s just a beginning


We’re not done yet. With modularization being such a wide topic, the two recently released pages are only a beginning. Help us shape the guidance by giving us feedback and telling us which issues you want us to cover. You can find us on social media or use the documentation issue tracker to report bugs.

Announcing the new guide to Android app modularization

Posted by Miłosz Moczkowski, Developer Relations Engineer, Android

As your app grows in size and complexity, it becomes increasingly difficult to manage, build and scale. One way to address this challenge is a software technique called modular programming, or modularization in short. It’s a practice of organizing a codebase into loosely coupled and independent entities - modules.

We know that modularization has been a hot topic among the Android developers community for quite some time now. Recently, we ran a survey to ask you about your experiences in this topic. 86% of developers said that they work on multi-module codebases regularly, while over 90% stated that modularization is a practice they would recommend considering.

All large apps are fundamentally modular, and at Google, we’ve been utilizing modularization to develop our most popular applications such as YouTube, Play Store or Google News. This is what Google News team has to say about this practice:

“Modularity of code is critical to managing complexity, stability, readability, and testability in an ever-growing codebase.”

On the other hand though, over 54% responders mentioned that it’s difficult to find good learning materials on this topic and almost 95% claimed that currently available materials on developer.android.com are insufficient! In response to this popular demand, we’ve launched the guide to Android app modularization. The guide is split into two parts. The overview page gives you a high level, theoretical overview of the matter and addresses the following questions:
  • What is modularization?
  • What are the benefits of modularizing my codebase?
  • What are the things to watch out for when modularizing?
  • Is modularization the right technique for you?
The common modularization patterns page dives deep into practical examples in the context of the modern Android architecture and gives answer to the these problems:
  • What is the low coupling & high cohesion principle?
  • What are the types of modules and their roles?
  • How do modules pass data between each other?

To see modularization in action, check out the Now in Android project. It's a fully functional app which has a multi-module codebase, and there's a handy modularization learning journey which outlines what the modules do and how they communicate with each other.

Is this for you?


This modularization guide is targeted to intermediate and advanced developers. The guide focuses on modularization from a software architecture point of view. If you’re a beginner, only starting your Android developer journey, you should familiarize yourself with our guide to app architecture first. Modularization guide assumes you are familiar with our recommended app architecture.

It’s just a beginning


We’re not done yet. With modularization being such a wide topic, the two recently released pages are only a beginning. Help us shape the guidance by giving us feedback and telling us which issues you want us to cover. You can find us on social media or use the documentation issue tracker to report bugs.

Announcing the new guide to Android app modularization

Posted by Miłosz Moczkowski, Developer Relations Engineer, Android

As your app grows in size and complexity, it becomes increasingly difficult to manage, build and scale. One way to address this challenge is a software technique called modular programming, or modularization in short. It’s a practice of organizing a codebase into loosely coupled and independent entities - modules.

We know that modularization has been a hot topic among the Android developers community for quite some time now. Recently, we ran a survey to ask you about your experiences in this topic. 86% of developers said that they work on multi-module codebases regularly, while over 90% stated that modularization is a practice they would recommend considering.

All large apps are fundamentally modular, and at Google, we’ve been utilizing modularization to develop our most popular applications such as YouTube, Play Store or Google News. This is what Google News team has to say about this practice:

“Modularity of code is critical to managing complexity, stability, readability, and testability in an ever-growing codebase.”

On the other hand though, over 54% responders mentioned that it’s difficult to find good learning materials on this topic and almost 95% claimed that currently available materials on developer.android.com are insufficient! In response to this popular demand, we’ve launched the guide to Android app modularization. The guide is split into two parts. The overview page gives you a high level, theoretical overview of the matter and addresses the following questions:
  • What is modularization?
  • What are the benefits of modularizing my codebase?
  • What are the things to watch out for when modularizing?
  • Is modularization the right technique for you?
The common modularization patterns page dives deep into practical examples in the context of the modern Android architecture and gives answer to the these problems:
  • What is the low coupling & high cohesion principle?
  • What are the types of modules and their roles?
  • How do modules pass data between each other?

To see modularization in action, check out the Now in Android project. It's a fully functional app which has a multi-module codebase, and there's a handy modularization learning journey which outlines what the modules do and how they communicate with each other.

Is this for you?


This modularization guide is targeted to intermediate and advanced developers. The guide focuses on modularization from a software architecture point of view. If you’re a beginner, only starting your Android developer journey, you should familiarize yourself with our guide to app architecture first. Modularization guide assumes you are familiar with our recommended app architecture.

It’s just a beginning


We’re not done yet. With modularization being such a wide topic, the two recently released pages are only a beginning. Help us shape the guidance by giving us feedback and telling us which issues you want us to cover. You can find us on social media or use the documentation issue tracker to report bugs.

Announcing the new guide to Android app modularization

Posted by Miłosz Moczkowski, Developer Relations Engineer, Android

As your app grows in size and complexity, it becomes increasingly difficult to manage, build and scale. One way to address this challenge is a software technique called modular programming, or modularization in short. It’s a practice of organizing a codebase into loosely coupled and independent entities - modules.

We know that modularization has been a hot topic among the Android developers community for quite some time now. Recently, we ran a survey to ask you about your experiences in this topic. 86% of developers said that they work on multi-module codebases regularly, while over 90% stated that modularization is a practice they would recommend considering.

All large apps are fundamentally modular, and at Google, we’ve been utilizing modularization to develop our most popular applications such as YouTube, Play Store or Google News. This is what Google News team has to say about this practice:

“Modularity of code is critical to managing complexity, stability, readability, and testability in an ever-growing codebase.”

On the other hand though, over 54% responders mentioned that it’s difficult to find good learning materials on this topic and almost 95% claimed that currently available materials on developer.android.com are insufficient! In response to this popular demand, we’ve launched the guide to Android app modularization. The guide is split into two parts. The overview page gives you a high level, theoretical overview of the matter and addresses the following questions:
  • What is modularization?
  • What are the benefits of modularizing my codebase?
  • What are the things to watch out for when modularizing?
  • Is modularization the right technique for you?
The common modularization patterns page dives deep into practical examples in the context of the modern Android architecture and gives answer to the these problems:
  • What is the low coupling & high cohesion principle?
  • What are the types of modules and their roles?
  • How do modules pass data between each other?

To see modularization in action, check out the Now in Android project. It's a fully functional app which has a multi-module codebase, and there's a handy modularization learning journey which outlines what the modules do and how they communicate with each other.

Is this for you?


This modularization guide is targeted to intermediate and advanced developers. The guide focuses on modularization from a software architecture point of view. If you’re a beginner, only starting your Android developer journey, you should familiarize yourself with our guide to app architecture first. Modularization guide assumes you are familiar with our recommended app architecture.

It’s just a beginning


We’re not done yet. With modularization being such a wide topic, the two recently released pages are only a beginning. Help us shape the guidance by giving us feedback and telling us which issues you want us to cover. You can find us on social media or use the documentation issue tracker to report bugs.

Announcing the new guide to Android app modularization

Posted by Miłosz Moczkowski, Developer Relations Engineer, Android

As your app grows in size and complexity, it becomes increasingly difficult to manage, build and scale. One way to address this challenge is a software technique called modular programming, or modularization in short. It’s a practice of organizing a codebase into loosely coupled and independent entities - modules.

We know that modularization has been a hot topic among the Android developers community for quite some time now. Recently, we ran a survey to ask you about your experiences in this topic. 86% of developers said that they work on multi-module codebases regularly, while over 90% stated that modularization is a practice they would recommend considering.

All large apps are fundamentally modular, and at Google, we’ve been utilizing modularization to develop our most popular applications such as YouTube, Play Store or Google News. This is what Google News team has to say about this practice:

“Modularity of code is critical to managing complexity, stability, readability, and testability in an ever-growing codebase.”

On the other hand though, over 54% responders mentioned that it’s difficult to find good learning materials on this topic and almost 95% claimed that currently available materials on developer.android.com are insufficient! In response to this popular demand, we’ve launched the guide to Android app modularization. The guide is split into two parts. The overview page gives you a high level, theoretical overview of the matter and addresses the following questions:
  • What is modularization?
  • What are the benefits of modularizing my codebase?
  • What are the things to watch out for when modularizing?
  • Is modularization the right technique for you?
The common modularization patterns page dives deep into practical examples in the context of the modern Android architecture and gives answer to the these problems:
  • What is the low coupling & high cohesion principle?
  • What are the types of modules and their roles?
  • How do modules pass data between each other?

To see modularization in action, check out the Now in Android project. It's a fully functional app which has a multi-module codebase, and there's a handy modularization learning journey which outlines what the modules do and how they communicate with each other.

Is this for you?


This modularization guide is targeted to intermediate and advanced developers. The guide focuses on modularization from a software architecture point of view. If you’re a beginner, only starting your Android developer journey, you should familiarize yourself with our guide to app architecture first. Modularization guide assumes you are familiar with our recommended app architecture.

It’s just a beginning


We’re not done yet. With modularization being such a wide topic, the two recently released pages are only a beginning. Help us shape the guidance by giving us feedback and telling us which issues you want us to cover. You can find us on social media or use the documentation issue tracker to report bugs.

Google Play announces the winners of the Indie Games Festival and the Accelerator class of 2022

Posted by Patricia Correa, Director, Global Developer Marketing

Today, at the finals of our Indie Games Festival, thousands of people came together to celebrate the passion, creativity and innovation of small games studios.

Players, jury members, and industry experts attended the event - hosted in a custom virtual world - where they discovered the finalist games and met the people who made them. They were also the first to find out who the winners are, who will receive prizes and promotions that will help them boost their visibility.

At the event we also announced the studios selected to join our Indie Games Accelerator. These companies will receive exclusive education and mentorship over a 10-week virtual program, to help them build and grow successful businesses.

Please join us in congratulating each of the winning games and studios.

Meet the festival winners

Europe

Dungeons of Dreadrock by Christoph Minnameier, from Germany
Please, Touch The Artwork by Thomas Waterzooi, from Belgium
Quadline by Ivan Kovalov, from Ukraine



South Korea

The Greater by IM GAME

Users' Choice Award:
Nyang Tower: Square Logic by Studio Box Cat

Japan

RASPBERRY MASH by IGNITION M
SOULVARS by ginolabo


Indie Games Accelerator | Class of 2022

Americas

Asantee Games - Brazil
Fiveamp Hawaii - US
MegaJogos - Brazil
Niebla Games - Chile
Northern Forge Studios - Canada
SHD Games Inc. - Canada
Skyborne Games Inc. - US
Solaris Mobile - Brazil
Starling Team - Brazil
Temple Gates Games - US
Asia Pacific

Drakemount - South Korea
Eternal Dream Studio - Indonesia
Gambir Studio - Indonesia
Hoit Studio - South Korea
Ranida Games - Philippines
Rigged Box Softworks - Indonesia
SweatyChair - Australia
The Sane Studio - South Korea
THEAND COMPANY - South Korea
Vnstart LLC - Vietnam
Europe, Middle East & Africa

Alcore Games - Ukraine
Appox AB - Sweden
Hammurabi Games - Turkiye
JE Software AB - Sweden
LoopyMood - Ukraine
PocApp Studios AB - Sweden
Rarepixels Indie Games - Spain
Rikzu Games - Portugal
Rojeh Maher - Egypt
Štěpán Fiala - Prague


Didn’t make it?

If you missed the event or would like to explore further, you can still log in to the virtual world and discover more about the finalists. Available for a limited time only. Explore now.

Stay tuned for more programs helping small games companies grow on Google Play.



How useful did you find this blog post?

Precise Improvements: How TikTok Enhanced its Video Social Experience on Android

Posted by The Android Developer Relations team

TL;DR


TikTok serves a wide range of user groups. With users around the world, it’s inevitable that some of them experience network issues such as slow, intermittent, or expensive connectivity. Other users are using entry level devices with limited memory and storage. Ensuring an excellent app experience in all these scenarios is paramount. TikTok's team was able to significantly improve their overall performance by following Android’s performance guidance, and employing their deep understanding of development tools such as Android Gradle Plugin and Jetpack libraries. If you want to learn how the TikTok team improved their app experience to achieve better business performance, please read our business article here.

Intro


TikTok is one of the most popular community-driven entertainment platforms with 1 billion people across the globe publishing and browsing video content every day.

A diverse user base naturally means diverse network bandwidth conditions and devices with different screen sizes, available memory and processing power. All users want a smooth, responsive app experience, no matter which device they use. If the app is slow to load, or playback gets stuck, users will feel frustrated and might abandon the app altogether. To avoid issues like these, the TikTok team continuously tracks the overall app performance through ongoing data monitoring, peer benchmarks, and user surveys.

TikTok is constantly introducing new features. But a rapid increase in functionality sometimes leads to an upsurge in technical requirements. The engineering team identified three reasons that slowed down the app : janky frames, video playback lag, and network issues. To solve these issues, the TikTok team looked to Android tools to start their app improvement journey.

From Discovery to Solution


Reducing app startup time, a smoother user experience with reduced jank and better video playback experience were three major goals that the team prioritized. They also discussed how to measure the effects of performance optimization to prevent the occurrence of regression.

1. Faster startup: refactor startup framework

App startup time is one of the metrics in Android Vitals. Making sure the app startup time is no longer than the Android Vital’s recommendation is the best way to ensure the app loads and starts responding to user activity as quickly as possible. The App Startup library is an Android Jetpack library to help developers initialize app components simply and efficiently.

The team studied the App Startup library in depth and refactored the app's startup framework to achieve on-demand loading and meticulous scheduling of components. In order to further reduce the execution time of creating Views on the main thread, the team even used a background thread to load View components asynchronously, thus improving the overall speed of app startup.

TikTok used Simpleperf to analyze the code execution time, and Android Studio's Profiler to monitor the usage of resources such as memory, CPU, and network to optimize I/O, threads, and resource locks.

2. Smoother user interface

To ensure a smoother user interface, the team needed to tackle two challenges: 1) simplify the View hierarchy, so that the app only renders what is necessary on screen, and 2) reduce the number of task executions in each frame so that the app can have a steady frame rate.

The TikTok team used the Layout Inspector in Android Studio to pinpoint the unnecessary layout contents. The layout boundaries of each View are clearly visible in the inspector, so the team can easily simplify the View hierarchy of the interface and reduce excessive and unnecessary content drawing.

In many cases, TikTok used doFrame() to perform frame-by-frame tasks. Trying to fit too much work in a single frame will inevitably cause a jank. TikTok's approach was to use allocation algorithms to distribute tasks into different frames to ensure that the application has a steady frame rate.

3. Better video playback experience: reuse resources

TikTok users can create audio and video content in various ways, and different codecs are used to play different types of content. Android provides the MediaCodec class to help access the underlying codec. To further improve the speed of video playback, it is good practice to provide different media player instances for different codecs. The TikTok team created a pool of media player instances throughout the application to neatly provide for various media contents. They even run each media player instance in different threads to minimize interference between one another

Network connection speed is another contributor to video lag . The team tested different solutions, including optimizing connections and reusing sockets, and developed algorithms to dynamically adjust buffer length when streaming content to reduce lag during playback.

They also used on-device video super-resolution to generate high-resolution frames based on low-resolution video content, further improving the quality of video playback without increasing network pressure.

Preloading (loading the next video ahead of time) and pre-rendering (rendering the first frame of the video ahead of time) are critical components to ensure that users have a smooth experience when playing multiple videos in succession. TikTok drew a Surface in advance only adding it into the screen when it is actually needed, to reduce the pressure of drawing it on the spot.

4. Avoid regressions

The team continues to maintain a detailed understanding of performance and works to fine-tune elements when necessary. Luckily, Android has tools in place for this exact purpose, like Systrace to capture traces so developers can export system activities (including CPU scheduling, disk activities, and app threads) for detailed analysis. The team also relies heavily on tools like Perfetto and Android Studio CPU profiler to track the execution time of various events, especially for I/O and class loading.

Better Performance, Better Experience


TikTok creatively leveraged the Android toolchain to track, quantify, and optimize their app’s performance for its business priorities, resulting in improved user experience and an increase in user satisfaction

The app startup time was reduced by 45%, and the smoothness (the chance of the frame rate being lower than the target value) has been optimized by 49%. When playing a video, the first frame of the video appeared 41% faster, and the chance of video lag was reduced by 27%.

Users are now more willing to use TikTok: active days per user in 30 days increased by 1%as did the average of session duration. User surveys and TikTok’s rating in Google Play also show a significant increase in user satisfaction.

The Next Stage for TikTok


By constantly optimizing app performance and adapting to the latest Android 13 platform, TikTok has created a more seamless app experience, encouraging more users to discover, create, and share the content they love.

With more than 250 million active large-screen Android devices globally, the team has also been focusing on large-screen devices, including foldable devices. By adopting the app to large screens, the team has brought a more immersive experience to TikTok users.

To learn more about how TikTok optimized its Android app to improve user experience and business performance, read the article here.

Get Guidance on Performance


To learn how you can get started to inspect, improve and monitor your app's performance visit our developer guide. The fastest way to improve your app's launch speed is by adding a baseline profile to your next release.

Announcing Cross device SDK Developer Preview for building rich multi-device experiences on Android

Posted by Alex Rocha - Developer Relations Engineer Manager, Ryan Ausanka-Crues - Eng Manager, Multi-device development, Stella Loh - Product Manager, Multi-device development

Today we’re launching our Developer Preview of the new Cross device SDK for Android. First announced during the Google I/O ‘22 Multi-device development session, our Cross device SDK allows developers to build rich multi-device experiences with a simple and intuitive set of APIs. This SDK abstracts away the intricacies involved with working with device discovery, authentication, and connection protocols, allowing you to focus on what matters most—building delightful user experiences and connecting these experiences across a variety of form factors and platforms.

What’s in Developer Preview

This initial release contains a set of rich APIs centered around the core functionality of Device discovery, Secure connections, and Multi-device Sessions.

  1. Device discovery: Easily find nearby devices, authorize peer-to-peer communication, and start the target application on receiving devices.
  2. Secure connections: Enable encrypted, low-latency bi-directional data sharing between authorized devices.
  3. Multi-device Sessions: Enable transferring or extending an application’s user experience across multiple devices.

In turn, this will allow you to build compelling cross-device experiences by enabling and simplifying the following use cases:

  • Discovering and authorizing communication with nearby devices.
  • Sharing an app’s current state with the same app on another device.
  • Starting the app on a secondary device without having to keep the app running in background.
  • Establishing secure connections for devices to communicate with each other.
  • Enabling task handoff where the user starts a task on one device, and can easily continue on another device.

Starting today with a Developer Preview for Android phones and tablets, the Cross device SDK will be available later for other Android surfaces and non-Android OSs.

Under The Hood

The Cross device SDK provides a software abstraction layer that handles all aspects of cross-device connectivity, leveraging wireless technologies such as Bluetooth, Wi-Fi, and Ultra-wide band; our SDK does all the heavy-lifting under the hood, offering you a modular,connectivity-agnostic API that supports bi-directional communication between devices and is backward compatible to Android 8. In addition, apps will not have to declare or request Runtime Permissions for any of the underlying connectivity protocols used (such as BLUETOOTH_CONNECT, BLUETOOTH_SCAN, ACCESS_FINE_LOCATION, etc.), and the user can allow apps to connect to only the device(s) they selected.

Getting started with Developer Preview

Head over to our developer guide to get started and try out the Developer Preview of the Cross device SDK for Android. Make sure to check out our Rock Paper Scissor sample app (Kotlin and Java) on GitHub for a demonstration on how to work with the various APIs and our Google I/O ‘22 Multi-device development session for a general overview of the SDK.

Feedback

We’d love to hear from you during this initial Developer Preview launch to help us shape the SDK and influence future roadmapping, so please share your feedback and let us know your experience with the SDK!

Wear OS Tiles Material Library: Build Tiles, Fast.

Posted by Anna Bernbaum, Product Manager, Ataul Munim, Developer Relations Engineer

We are excited to announce the launch of the Tiles Material library! Now, instead of building buttons, progress arcs and more from scratch, you can use our pre-built Material components and layouts to create tiles that embrace the latest Material design for Wear OS. You can use these together with the Tiles Design Kit to easily follow the Tiles Design Guidelines.

Tiles provide Wear OS users glanceable access to the information and actions they need in order to get things done quickly. They also are one of the most used surfaces on Wear OS. Just one swipe away from the watch face, users can quickly access the most important information or actions from an app, like starting a timer or getting the latest weather forecast.

animation showing the tiles experience on Wear OS. User swipes left from the watch face to see the first tile, and continues swiping to see others, including a fitness tile with buttons to initiate a workout, a music tile with chips to navigate to playlists, an alarm tile showing an upcoming alarm, among others.
Tiles carousel on Wear OS

We have built the following components for elements commonly used in tiles:
common tile components. a round icon with a pencil labelled "button". a full width rectangle with rounded corners and text labelled "chip". similar components, one larger and one smaller, labelled "title chip" and "compact chip" respectively. a circle path filled 75% clockwise labelled "circular progress indicator" and finally text labelled "text with recommended typography pre-set"

These components also make it faster to build tiles. For example, creating a button for your tile takes just a few lines of code:

val clickable: Clickable = generateClickable()

val button: Button = Button.Builder(this, clickable)
    .setIconContent("icon_exercise")

    .setContentDescription("Start workout")

    .build()



We have also created some predefined layouts to kickstart your tiles development. These already follow our design guidelines on how your tile layout should be formatted.
A calendar event tile with vertically stacked text details with an "open" action at the bottom, a weather tile showing a cloud icon, the current temperature and the day's high and low in a single row, a step counter tile with a progress indicator encircling the content and a timer tile with 5 buttons for different durations.

For example, we can build this tile using a predefined layout:
Tile with a PrimaryLayout, showing "Primary label text" at the top and "Action" as the primary chip at the bottom. The content slot is a MultiButtonLayout with 2 round icons , each with the plus sign.

val theme = Colors(

    /*primary=*/ 0xFFD0BCFF.toInt(), /*onPrimary=*/ 0xFF381E72.toInt(),

    /*surface=*/ 0xFF202124.toInt(), /*onSurface=*/ 0xFFFFFFFF.toInt()

)

val buttonColors = ButtonColors.secondaryButtonColors(theme)

val chipColors = ChipColors.primaryChipColors(theme)

val timeline = Timeline.fromLayoutElement(
    PrimaryLayout.Builder(deviceParameters)

        .setPrimaryLabelTextContent(

            Text.Builder(this, "1 run this week")

                .setTypography(Typography.TYPOGRAPHY_CAPTION1)

                .setColor(argb(theme.primary))

                .build()

        )

        .setContent(

            MultiButtonLayout.Builder()

                .addButtonContent(

                    Button.Builder(this, clickable)

                        .setIconContent("icon_run")

                        .setButtonColors(buttonColors)

                        .setContentDescription("Run")

                        .build()

                )

                .addButtonContent(

                    Button.Builder(this, clickable)

                        .setIconContent("icon_yoga")

                        .setButtonColors(buttonColors)

                        .setContentDescription("Yoga")

                        .build()

                )
                .addButtonContent(

                    Button.Builder(this, clickable)

                        .setIconContent("icon_cycle")

                        .setButtonColors(buttonColors)

                        .setContentDescription("Cycle")

                        .build()

                )

                .build()

        )

        .setPrimaryChipContent(

            CompactChip.Builder(this, "More", clickable, deviceParameters)

                .setChipColors(chipColors)

                .build()

        )

        .build()

)


What's in the library

This library contains components and layouts that are in-line with Material guidelines and easy to use. The included components are:
  • Button - clickable, circular-shaped object, with either icon, text or image with three predefined sizes.
  • Chip - clickable, stadium-shaped object that can contain an icon, primary and secondary labels, and has fixed height and customizable width.
  • CompactChip & TitleChip - two variations of the standard Chip that have smaller and larger heights, respectively, and can contain one line of text.
  • CircularProgressIndicator - colored arc around the edge of the screen with the given start and end angles, which can describe a full or partial circle with the full progress arc behind it.
  • Text - styled text which uses the recommended Wear Material typography styles.
All these components have their own colors object that can be built with the main Colors class to easily apply the same theme over all components. In addition to colors, there is a Typography class to easily get FontStyle objects using the typography name.

In addition to components, there are recommended tile layouts:
  • PrimaryLayout - a layout which can be customized by adding primary or secondary labels, content in the middle, and a primary chip at the bottom. The main content within this layout could be added as a MultiSlotLayout or MultiButtonLayout object.
  • EdgeContentLayout - a layout for hosting CircularProgressIndicator around the edge with main content inside and primary or secondary label around it.
  • MultiButtonLayout - a layout that can contain between 1 - 7 buttons, arranged in line with the Material guidelines depending on their number.
  • MultiSlotLayout - a row-like style layout with horizontally aligned and spaced slots (for icons or other small content).
All layouts have recommended padding and styles applied that are within Material guidelines.


Tools for tiles

Android Studio Dolphin includes the Direct Surface Launch feature. This lets developers install and launch a tile directly from Android Studio, instead of having to manually add it from the tile selector on the target device. Get started with Direct Surface Launch by creating a new Run Configuration and selecting Wear OS Tile, then choosing the module and TileService class.

Horologist Tiles is also recommended to save time during tile development. This library gives you the ability to preview a tile UI straight from Android Studio, making the write-test loop a lot shorter. Horologist Tiles also includes Kotlin friendly abstractions, like CoroutinesTileService so you can use what you're already familiar with.


Get started with Tiles Material

For a quick start, take a look at the new Tiles codelab, the code sample and the docs.

Please share your feedback on the issue tracker and let us know what you think of Tiles Material!









CameraX 1.2 is now in Beta

Posted by Donovan McMurray, CameraX Developer Relations Engineer

As part of Android Jetpack, the CameraX library makes complex camera functionality available in an easy-to-use API, helping you create a best-in-class experience that works consistently across Android versions and devices. As of today, CameraX version 1.2 is officially in Beta. Update from version 1.1 to take advantage of the latest game-changing features: our new ML Kit integration, which can reduce your boilerplate code when using ML Kit in a CameraX app, and Zero-Shutter Lag, which enables faster action shots than were previously possible.

These two advanced features are simple to implement with CameraX 1.2, so let’s take a look at each of them in depth.

ML Kit Integration

Google’s ML Kit provides several on-device vision APIs for detecting faces, barcodes, text, objects, and more. We’re making it easier to integrate these APIs with CameraX. Version 1.2 introduces MlKitAnalyzer, an implementation of ImageAnalysis.Analyzer that handles much of the ML Kit setup for you.


You can use MlKitAnalyzer with both cameraController and cameraProvider workflows. If you use the cameraController.setImageAnalysisAnalyzer() method, then CameraX can also handle the coordinates transformation between the ML Kit output and your PreviewView.

Here’s a code snippet using setImageAnalysisAnalyzer() to set a BarcodeScanner on a cameraController to detect QR codes. CameraX automatically handles the coordinate transformations when you pass COORDINATE_SYSTEM_VIEW_REFERENCED into the MlKitAnalyzer. (Use COORDINATE_SYSTEM_ORIGINAL to prevent CameraX from applying any coordinate transformations.)

val options = BarcodeScannerOptions.Builder()

  .setBarcodeFormats(Barcode.FORMAT_QR_CODE)

  .build()

val barcodeScanner = BarcodeScanning.getClient(options)


cameraController.setImageAnalysisAnalyzer(

  executor,

  new MlKitAnalyzer(List.of(barcodeScanner),

    COORDINATE_SYSTEM_VIEW_REFERENCED,

    executor, result -> {

      // The value of result.getResult(barcodeScanner)

      // can be used directly for drawing UI overlay.

    }

  )

)



Zero-Shutter Lag

Have you ever lined up the perfect photo, but when you click the shutter button the lag causes you to miss the best moment? CameraX 1.2 offers a solution to this problem by introducing Zero-Shutter Lag.

Prior to CameraX 1.2, you could optimize for quality (CAPTURE_MODE_MAXIMIZE_QUALITY) or efficiency (CAPTURE_MODE_MINIMIZE_LATENCY) when calling ImageCapture.Builder.setCaptureMode(). CameraX 1.2 adds a new value (CAPTURE_MODE_ZERO_SHOT_LAG) that reduces latency even further than CAPTURE_MODE_MINIMIZE_LATENCY. Note: for devices that cannot support Zero-Shutter Lag, CameraX will fallback to CAPTURE_MODE_MINIMIZE_LATENCY.

We accomplish this by using a circular buffer of photos. On image capture, we go back in time in the circular buffer to get the frame closest to the actual press of the shutter button. No DeLorean needed. Great Scott!

Here’s an example of how this works in a CameraX app with Preview and ImageCapture use cases:


  1. Just like any other app with a Preview use case, CameraX sends images from the camera to the UI for the user to see.
  2. With Zero-Shutter Lag, CameraX also sends images to a circular buffer which holds multiple recent images.
  3. When the user presses the shutter button, there is inevitably some lag in sending the current camera image to your app. For this reason, Zero-Shutter Lag goes to the circular buffer to fetch an image.
  4. CameraX finds the photo in the circular buffer closest to the actual time when the user pressed the shutter button, and returns that photo to your app.
There are a few limitations to keep in mind with Zero-Shutter Lag. First, please be mindful that this is still an experimental feature. Second, since keeping a circular buffer of images is computationally intensive, you cannot use CAPTURE_MODE_ZERO_SHOT_LAG while using VideoCapture or extensions. Third, the circular buffer will increase the memory footprint of your app.


Next steps


Check our full release notes for CameraX 1.2 for more details on the features described here and more! If you’re ready to try out CameraX 1.2, update your project’s CameraX dependency to 1.2.0-beta01 (or the latest version at the time you’re reading this).

If you would like to provide feedback on any of these features or CameraX in general, please create a CameraX issue. As always, you can also reach out on our CameraX Discussion Group.