Tag Archives: Wear OS

Develop watch faces with the stable Jetpack Watch Face library

Posted by Alex Vanyo, Developer Relations Engineer

Illustration of tan hand showing a watch

Watch faces are one of the most visible ways that people express themselves on their smartwatches, and they’re one of the best ways to display your brand to your users.

Watch Face Studio from Samsung is a great tool for creating watch faces without writing any code. For developers who want more fine-tuned control, we've recently launched the Jetpack Watch Face library written from the ground up in Kotlin.

The stable release of the Jetpack Watch Face library includes all functionality from the Wearable Support Library and many new features that make it easier to support customization on the smartwatch and on the system companion app on mobile, including:

  • Watch face styling which persists across both the watch and phone (with no need for your own database or companion app).
  • Support for a WYSIWYG watch face configuration UI on the phone.
  • Smaller, separate libraries (that only include what you need).
  • Battery improvements through encouraging good battery usage patterns out of the box, such as automatically reducing the interactive frame rate when battery is low.
  • New screenshot APIs so users can see previews of their watch face changes in real time on both the watch and phone.

If you are still using the Wearable Support Library, we strongly encourage migrating to the new Jetpack libraries to take advantage of the new APIs and upcoming features and bug fixes.


Below is an example of configuring a watch face from the phone with no code written on or for the phone.

GIF showing how to edit a watch face using the Galaxy Wearable mobile companion app

Editing a watch face using the Galaxy Wearable mobile companion app


If you use the Jetpack Watch Face library to save your watch face configuration options, the values are synced with the mobile companion app. That is, all the cross-device communication is handled for you.

The mobile app will automatically present those options to the user in a simple, intuitive user interface where they change them to whatever works best for their style. It also includes previews that update in real time.

Let’s dive into the API with an overview of the most important components for creating a custom watch face!


WatchFaceService

A subclass of WatchFaceService forms the entry point of any Jetpack watch face. Implementing a WatchFaceService requires creating 3 objects: A UserStyleSchema, a ComplicationSlotsManager, and a WatchFace:

Diagram showing the 3 main parts of a WatchFaceService

Diagram showing the 3 main parts of a WatchFaceService

These 3 objects are specified by overriding 3 abstract methods from WatchFaceService:

class CustomWatchFaceService : WatchFaceService() {

    /**
     * The specification of settings the watch face supports.
     * This is similar to a database schema.
     */
    override fun createUserStyleSchema(): UserStyleSchema = // ...

    /**
     * The complication slot configuration for the watchface.
     */
    override fun createComplicationSlotsManager(
        currentUserStyleRepository: CurrentUserStyleRepository
    ): ComplicationSlotsManager = // ...

    /**
     * The watch face itself, which includes the renderer for drawing.
     */ 
    override suspend fun createWatchFace(
        surfaceHolder: SurfaceHolder,
        watchState: WatchState,
        complicationSlotsManager: ComplicationSlotsManager,
        currentUserStyleRepository: CurrentUserStyleRepository
    ): WatchFace = // ...

}

Let’s take a more detailed look at each one of these in turn, and some of the other classes that the library creates on your behalf.


UserStyleSchema

The UserStyleSchema defines the primary information source for a Jetpack watch face. The UserStyleSchema should contain a list of all customization settings available to the user, as well as information about what those options do and what the default option is. These settings can be boolean flags, lists, ranges, and more.

By providing this schema, the library will automatically keep track of changes to settings by the user, either through the mobile companion app on a connected phone or via changes made on the smartwatch in a custom editor activity.

    override fun createUserStyleSchema(): UserStyleSchema =
        UserStyleSchema(
            listOf(
                // Allows user to change the color styles of the watch face
                UserStyleSetting.ListUserStyleSetting(
                    UserStyleSetting.Id(COLOR_STYLE_SETTING),
                    // ...
                ),
                // Allows user to toggle on/off the hour pips (dashes around the outer edge of the watch
                UserStyleSetting.BooleanUserStyleSetting(
                    UserStyleSetting.Id(DRAW_HOUR_PIPS_STYLE_SETTING),
                    // ...
                ),
                // Allows user to change the length of the minute hand
                UserStyleSetting.DoubleRangeUserStyleSetting(
                    UserStyleSetting.Id(WATCH_HAND_LENGTH_STYLE_SETTING),
                    // ...
                )
            )
        )

CurrentUserStyleRepository

The current user style can be observed via the ​​CurrentUserStyleRepository, which is created by the library based on the UserStyleSchema.

It gives you a UserStyle which is just a Map with keys based on the settings defined in the schema:

Map<UserStyleSetting, UserStyleSetting.Option>

As the user’s preferences change, a MutableStateFlow of UserStyle will emit the latest selected options for all of the settings defined in the UserStyleSchema.

currentUserStyleRepository.userStyle.collect { newUserStyle ->
    // Update configuration based on user style
}

CurrentUserStyleRepository

Complications allow a watch face to display additional information from other apps on the watch, such as events, health data, or the day.

The ComplicationSlotsManager defines how many complications a watch face supports, and where they are positioned on the screen. To support changing the location or number of complications, the ComplicationSlotsManager also uses the ​​CurrentUserStyleRepository.

    override fun createComplicationSlotsManager(
        currentUserStyleRepository: CurrentUserStyleRepository
    ): ComplicationSlotsManager {
        val defaultCanvasComplicationFactory =
            CanvasComplicationFactory { watchState, listener ->
                // ...
            }
    
        val leftComplicationSlot = ComplicationSlot.createRoundRectComplicationSlotBuilder(
            id = 100,
            canvasComplicationFactory = defaultCanvasComplicationFactory,
            // ...
        )
            .setDefaultDataSourceType(ComplicationType.SHORT_TEXT)
            .build()
    
        val rightComplicationSlot = ComplicationSlot.createRoundRectComplicationSlotBuilder(
            id = 101,
            canvasComplicationFactory = defaultCanvasComplicationFactory,
            // ...
        )
            .setDefaultDataSourceType(ComplicationType.SHORT_TEXT)
            .build()

        return ComplicationSlotsManager(
            listOf(leftComplicationSlot, rightComplicationSlot),
            currentUserStyleRepository
        )
    }

WatchFace

The WatchFace describes the type of watch face and how to draw it.

A WatchFace can be specified as digital or analog and can optionally have a tap listener for when the user taps on the watch face.

Most importantly, a WatchFace specifies a Renderer, which actually renders the watch face:

    override suspend fun createWatchFace(
        surfaceHolder: SurfaceHolder,
        watchState: WatchState,
        complicationSlotsManager: ComplicationSlotsManager,
        currentUserStyleRepository: CurrentUserStyleRepository
    ): WatchFace = WatchFace(
        watchFaceType = WatchFaceType.ANALOG,
        renderer = // ...
    )

Renderer

The prettiest part of a watch face! Every watch face will create a custom subclass of a renderer that implements everything needed to actually draw the watch face to a canvas.

The renderer is in charge of combining the UserStyle (the map from ​​CurrentUserStyleRepository), the complication information from ComplicationSlotsManager, the current time, and other state information to render the watch face.

class CustomCanvasRenderer(
    private val context: Context,
    surfaceHolder: SurfaceHolder,
    watchState: WatchState,
    private val complicationSlotsManager: ComplicationSlotsManager,
    currentUserStyleRepository: CurrentUserStyleRepository,
    canvasType: Int
) : Renderer.CanvasRenderer(
    surfaceHolder = surfaceHolder,
    currentUserStyleRepository = currentUserStyleRepository,
    watchState = watchState,
    canvasType = canvasType,
    interactiveDrawModeUpdateDelayMillis = 16L
) {
    override fun render(canvas: Canvas, bounds: Rect, zonedDateTime: ZonedDateTime) {
        // Draw into the canvas!
    }

    override fun renderHighlightLayer(canvas: Canvas, bounds: Rect, zonedDateTime: ZonedDateTime) {
        // Draw into the canvas!
    }
}

EditorSession

In addition to the system WYSIWYG editor on the phone, we strongly encourage supporting configuration on the smartwatch to allow the user to customize their watch face without requiring a companion device.

To support this, a watch face can provide a configuration Activity and allow the user to change settings using an EditorSession returned from EditorSession.createOnWatchEditorSession. As the user makes changes, calling EditorSession.renderWatchFaceToBitmap provides a live preview of the watch face in the editor Activity.

To see how the whole puzzle fits together to tell the time, check out the watchface sample on GitHub. To learn more about developing for Wear OS, check out the developer website.

Watch out for Wear OS at Android Dev Summit 2021

Posted by Jeremy Walker, Developer Relations Engineer

image of 4 watch faces against dark blue background.

This year’s Android Dev Summit had many exciting announcements for Android developers, including some major updates for the Wear OS platform. At Google I/O, we announced the launch of the new Wear OS. Since then, Wear OS Powered by Samsung has launched on the Galaxy Watch4 series. Many developers such as Strava, Spotify, and Calm have already created helpful experiences for the latest version of Wear OS, and we’re looking forward to seeing what new experiences developers will help bring to the watch. To learn more and create better apps for the wrist, read more about the updates to our APIs, design tools, and the Play store.


Compose for Wear OS

The Jetpack Compose library simplifies and accelerates UI development, and we’re bringing Compose support to Wear OS. You can design your app with familiar UI components, adapted for the watch. These components include Material You, so you can create beautiful apps with less code.

Compose for Wear OS is now in developer preview. To learn more and get started:

Try it out and share your feedback here or join the #compose-wear channel on the Jetbrains Slack and let us know there! Make sure you do it before we finalize APIs during beta!


Watch Face Studio

image of clock face in editing software

Watch faces are one of the most visible ways that users can express themselves on their smartwatches. Creating a watch face is a great way to showcase your brand for users on Wear OS. We’ve partnered with Samsung to provide better tools for watch face creation and make it easier to design watch faces for the Wear OS ecosystem.

Watch Face Studio is a design tool created by Samsung that allows you to produce and distribute your own watch faces without any coding. It includes includes intuitive graphics tools to allow you to easily design watch faces. You can create watch faces for your personal use, or upload them in Google Play Console to share with your users on Wear OS devices that support API level 28 and above.


Library updates

We recently released a number of Android Jetpack Wear OS libraries to help you follow best practices, reduce boilerplate, and create performant, glanceable experiences for your users.

Tiles are now enabled for most devices in the market, providing predictable, glanceable access to information and quick actions. The API is now in beta, check it out!

For developers who want more fine-grain control of their watch faces (outside of Watch Face Studio), we've launched the new Jetpack Watch Face APIs beta built from the ground up in Kotlin.

The new API offers a number of new features:

  • Watch face styling which persists across both the watch and phone (no need for your own database).
  • Support a WYSIWYG watch face configuration UI on the phone.
  • Smaller, separate libraries (only include what you need).
  • Battery improvements by encouraging good battery usage patterns out of the box; for example, reducing the interactive frame rate when battery is low.
  • New Screenshot APIs so users can see their watch face changes in real time.
  • And many more...

This is a great time to start moving from the older Watch Face Support Library to this new version.


Play Store updates

We’re making it easier for people to discover your Wear OS apps in the Google Play Store. Earlier this year, we enabled searching for watch faces and made it easier for people to find your apps in the Wear category. We also launched the capability for people to download apps onto their watches directly from the mobile Play Store. You can read more about these changes here.

We’ve also released updated Wear OS quality guidelines to help you meet your users’ expectations, as well as new screenshot guidelines to help your users have a better understanding of what your app will look like. To help people better understand how your app would work on their device in their location, we will be launching form factor and location specific ratings in 2022.

To learn more about developing for Wear OS, check out the developer website.

5 things to try with Wear OS on the Samsung Galaxy Watch4

For over a decade, Samsung and Google have worked together to push mobile technology forward across smartphones, tablets and foldables. We both want to bring users the best experiences possible, and as partners, we love a challenge. And now, we’re ready to take our collaboration to the next level with smartwatches. 


Smartwatches are the next step in mobile computing and we’re truly excited about the future of wearables. Today at Unpacked, Samsung unveiled its new Galaxy Watch4 with Wear OS Powered by Samsung. It’s the first smartwatch running on our unified platform.


We’re taking what we’ve learned from Wear OS and Tizen to jointly build what smartwatch users need. Compared to previous Wear OS smartwatches, the Galaxy Watch4 features a 2.5x shorter set up experience, up to 40 hours of battery life, optimized performance with app launch times 30 percent faster than before and access to a huge ecosystem of apps and services.


And there are more ways to get more done from your wrist with Wear OS. We’re introducing more capabilities and a fresh new look based on Material You design language for Google Maps, Messages by Google and Google Pay apps as well as launching a YouTube Music app. There are also new apps and Tiles coming to Wear OS for quicker access to your favorites. Let’s get into the details:

1. Navigate with Google Maps on your wrist

The Google Maps app on Wear OS will get you to your destination as efficiently as possible, whether you’re walking, cycling or driving. Turn-by-turn directions sent from phone to watch will help you to arrive on time. The watch app also syncs with Google Maps on your phone, and will show the home and work addresses you’ve added for easy access, as well as recent searches so you can start navigating where you want to go quickly.
Watch showing Google Maps

2. Stay connected with Messages by Google

With the updated Messages by Google app, you can receive messages on the go and easily reply directly from your watch without needing to take out your phone. The Messages app on your watch syncs with your phone, so your conversations stay up to date. If you’re in the United States, South Korea or Japan, you can download Messages on your Galaxy Watch4 from Google Play. For all other supported countries, Messages will already be available on your smartwatch.

Watch showing Messages by Google in a scrolling gif

3. Pay in more countries with Google Pay

Easy contactless payment from your wrist has always been a part of Wear OS. We’re now expanding support for Google Pay to 16 new countries including Belgium, Brazil, Chile, Croatia, Czech Republic, Denmark, Finland, Hong Kong, Ireland, New Zealand, Norway, Slovakia, Sweden, Taiwan, Ukraine and United Arab Emirates, with more to come. You’ll also see the app’s revamped design so credit cards stored in your wallet are larger and easier to swipe through. 

To use Google Pay on your Galaxy Watch4, download the app in Google Play on your smartwatch. Once Google Pay is added to your smartwatch, you’ll be able to see it alongside your other apps.

Watch showing Google Pay

4. Download and listen to your favorite tunes with YouTube Music

YouTube Music Premium subscribers will enjoy access to more than 80 million songs and thousands of playlists on the new YouTube Music app on Wear OS. This standalone app is the first smartwatch app from YouTube Music that allows YouTube Music Premium subscribers to download music for ad-free offline listening, even without your phone nearby. The app also comes with the Smart Downloads feature, which refreshes the songs you’ve downloaded to your watch whenever it’s charging and connected to WiFi. You can even use tailored playlists for the perfect soundtrack, whatever you’re doing. 

YouTube Music will be available for download to your Galaxy Watch4 from Google Play.

Watch showing YouTube Music app

5. Discover new Google Play apps and Tiles

At Google I/O, we shared that we’ve been working with developers to bring richer, immersive apps to Wear OS. We also made updates to Google Play for Wear OS so it’s easier to discover and download apps. Now we’re introducing new experiences from your favorite apps to your smartwatch, including Calm, Komoot, MyFitnessPal, Period Tracker, Sleep Cycle, Spotify, Strava and many more.


Six different watches showing different third-party apps

Many of these apps will also launch new third-party Tiles, so there’s a quick way to access the information and actions you care about most.

This will all be available on your Galaxy Watch4 and Galaxy Watch4 Classic, available for pre-order in select markets today and in retail starting August 27. And for current Wear OS users, you’ll see some of these updates begin to roll out starting today.

Sharing Tiles with your smartwatch users:

Posted by Jeremy Walker, Engineer

Tiles provide quick access to information and actions with a simple swipe from the watch face home screen. This gives smartwatch users more control over what information and actions they want to see, and it’s no surprise that Tiles have become one of the most helpful and useful features for smartwatches that run on Wear OS.

Today we’re announcing Tiles can be shared with your smartwatch users. You can start creating your custom Tile by downloading the latest Alpha release of the Jetpack Tiles API. Once you upload your experience to Google Play, your users will be able to download your Tile and start using it. Let your users know they can try out the new experience. You can also upload a screenshot of your Tile to your Play Store preview assets within Google Play Console.

Apps such as Calm and Sleep Cycle have already started building custom Tiles.


Tiles blog









"Using the new Tiles API, we were able to easily expose our Wear app features to be just a swipe away from your watch face." -Samo Kralj, Android Staff Software Engineer at Calm.

Tiles blog











The API was easy to understand and the documentation was quite clear, enabling us to have our first tile running with real data within hours. It feels like a very modern API that is easy to get started with.” -Viktor Åkerskog, Technical Lead at Sleep Cycle












We've appreciated all your feedback on the alpha library, and have included many of the requests and performance improvements into the APIs. You can add any additional feedback here to help us prioritize API improvements for future releases.

If you haven't had a chance to try out the API, check out the guide, or if you prefer a walkthrough, explore the Tiles codelab.

Happy coding!

What’s new for Android developers at Google I/O

Cross-posted on the Android Developers blog by Karen Ng, Director, Product Management & Jacob Lehrbaum, Director of Developer Relations, Android & Play

As Android developers, we are all driven by building experiences that delight people around the world. And with people depending on your apps more than ever, expectations are higher and your jobs as developers aren’t getting easier. Today, at Google I/O, we covered a few ways that we’re trying to help out, whether it be through Android 12 - one of the biggest design changes ever, Jetpack, Jetpack Compose, Android Studio, and Kotlin to help you build beautiful high quality apps. We’re also helping when it comes to extending your apps wherever your users go, like through wearables and larger-screened devices. You can watch the full Developer Keynote, but here are a few highlights:

Android 12: one of the biggest design updates ever.

The first Beta of Android 12 just started rolling out, and it’s packed with lots of cool stuff. From new user safety features like permissions for bluetooth and approximate location, enhancements to performance like expedited jobs and start up animations, to delightful experiences with more interactive widgets and stretch overscrolling, this release is one of the biggest design updates to Android ever. You can read more about what’s in Android 12 Beta 1 here, so you can start preparing your apps for the consumer release coming out later this year. Download the Beta and try it with your apps today!

Android 12 visual

Jetpack Compose: get ready for 1.0 in July!

For the last few years, we’ve been hard at work modernizing the Android development experience, listening to your feedback to keep the openness–a hallmark of Android, but becoming more opinionated about the right way to do things. You can see this throughout, from Android Studio, a performant IDE that can keep up with you, to Kotlin, a programming language that enables you to do more with less code, to Jetpack libraries that solve the hardest problems on mobile with backward compatibility.

The next step in this offering is Jetpack Compose - our modern UI toolkit to easily build beautiful apps for all Android devices. We announced Compose here at Google I/O two years ago and since then have been building it in the open, listening to your feedback to make sure we got it right. With the Compose Beta earlier this year, developers around the world have created some truly beautiful, innovative experiences in half the time, and the response to the #AndroidDevChallenge blew our socks off!

With the forthcoming update of Material You (which you can read more about here), we’ll be adding new Material components as well as further support for building for large screens, making it fast and easy to build a gorgeous UI. We’re pressure testing the final bits in Compose and will release 1.0 Stable in July—so get ready!

Android Studio Arctic Fox: Design, Devices, & Developer Productivity!

Android Studio Arctic Fox (2020.3.1) Beta, the latest release of the official powerful Android IDE, is out today to help you build quality apps easier and faster. We have delivered and updated the suite of tools to empower three major themes: accelerate your UI design, extend your app to new devices, and boost your developer productivity. With this latest release you can create modern UIs with Compose tooling, see test results across multiple devices, and optimize debugging databases and background tasks with the App Inspector. We’re also making your apps more accessible with the Accessibility Scanner and more performant with Memory Profiler. And for faster build speeds, we have the Android Gradle plugin 7.0, new DSL, and variant APIs. You can learn more about the Android Studio updates here.

Android Studio Arctic Fox

Kotlin: the most used language by professional Android devs

Kotlin is now the most used primary language by professional Android developers according to our recent surveys; in fact, over 1.2M apps in the Play Store use Kotlin, including 80% of the top 1000 apps. And here at Google, we love it too: 70+ Google apps like Drive, Home, Maps and Play use Kotlin. And with a brand-new native solution to annotation processing for Kotlin built from the ground up, Kotlin Symbol Processing is available today, a powerful and yet simple API for parsing Kotlin code directly, showing speeds up to 2x faster with libraries like Room.

Android Jetpack: write features, not boilerplate

With Android Jetpack, we built a suite of libraries to help reduce boilerplate code so you can focus on the code you care about. Over 84% of the top 10,000 apps are now using a Jetpack library. And today, we’re unpacking some new releases for Jetpack, including Jetpack Macrobenchmark (Alpha) to capture large interactions that affect your app startup and jank before your app is released, as well as a new Kotlin Coroutines API for persisting data more efficiently via Jetpack DataStore (Beta). You can read about all the updates in Android Jetpack here.

Now is the time: a big step for Wear

The best thing about modern Android development is that these tools have been purpose built to help make it easy for you to build for the next era of Android, which is all about enabling devices connected to your phone–TVs, cars, watches, tablets–to work better together.

Starting today, we take a huge step forward with wearables. First, we introduced a unified platform built jointly with Samsung, combining the best of Wear and Tizen. Second, we shared a new consumer experience with revamped Google apps. And third, a world-class health and fitness service from Fitbit is coming to the platform. As an Android developer, it means you’ll have more reach, and you’ll be able to use all of your existing skills, tools, and APIs that make your mobile apps great, to build for a single wearables platform used by people all over the world.

Whether it’s new Jetpack APIs for Wear tailored for small screens and designed to optimize battery life, to the Jetpack Tiles API, so you can create a custom Tile for all the devices in the Wear ecosystem, there are a number of new features to help you build on Wear. And with a new set of APIs for Health and Fitness, created in collaboration with Samsung, data collection from sensors and metrics computation is streamlined, consistent, and accurate–like heart rate to calories to daily distance–from one trusted source. All this comes together in new tooling, with the release of Android Studio Arctic Fox Beta, like easier pairing to test apps, and even a virtual heart rate sensor in the emulator. And when your app is ready, users will have a much easier time discovering the world of Wear apps on Google Play, with some big updates to discoverability. You can read more about all of the Wear updates here.

Tapping the momentum of larger screens, like tablets, Chrome OS and foldables

When it comes to larger screens -- tablets, foldables, and Chrome OS laptops-- there is huge momentum. People are increasingly relying on large screen devices to stay connected with family and friends, go to school, or work remotely. In fact, there are over 250 million active large screen Android devices. Last year, Chrome OS grew +92% year over year–5 times the rate of the PC market, making Chrome OS the fastest growing and the second-most popular desktop OS. To help you take advantage of this momentum, we’re giving you APIs and tools to make optimizing that experience easier: like having your content resize automatically to more space by using SlidingpaneLayout 1.2.0 and a new vertical navigation rail component, Max widths on components to avoid stretched UIs, as well as updates to the platform, Chrome OS, and Jetpack windowmanager, so apps work better by default. You can learn more here.

Google Duo's optimized experience for foldable devices

Google Duo's optimized experience for foldable devices

This is just a taste of some of the new ways we’re making it easier for you to build high quality Android apps. Later today, we’ll be releasing more than 20 technical sessions on Android and Play, covering a wide range of topics such as background tasks, privacy, and Machine Learning on Android, or the top 12 tips to get you ready for Android 12. If building for cars, TVs, and wearables is your thing, we got that covered, too. You can find all these sessions - and more - on the I/O website. Beyond the sessions and news, there’s a number of fun ways to virtually connect with Googlers and other developers at this year’s Google I/O. You can check out the Android dome in I/O Adventure, where you can see new blog posts, videos, codelabs, and more. Maybe even test out your Jetpack Compose skills or take a virtual tour of the cars inside our dome!

What’s new for Android developers at Google I/O

Posted by Karen Ng, Director, Product Management & Jacob Lehrbaum, Director of Developer Relations, Android & Play

As Android developers, we are all driven by building experiences that delight people around the world. And with people depending on your apps more than ever, expectations are higher and your jobs as developers aren’t getting easier. Today, at Google I/O, we covered a few ways that we’re trying to help out, whether it be through Android 12 - one of the biggest design changes ever, Jetpack, Jetpack Compose, Android Studio, and Kotlin to help you build beautiful high quality apps. We’re also helping when it comes to extending your apps wherever your users go, like through wearables and larger-screened devices. You can watch the full Developer Keynote, but here are a few highlights:

Android 12: one of the biggest design updates ever.

The first Beta of Android 12 just started rolling out, and it’s packed with lots of cool stuff. From new user safety features like permissions for bluetooth and approximate location, enhancements to performance like expedited jobs and start up animations, to delightful experiences with more interactive widgets and stretch overscrolling, this release is one of the biggest design updates to Android ever. You can read more about what’s in Android 12 Beta 1 here, so you can start preparing your apps for the consumer release coming out later this year. Download the Beta and try it with your apps today!

Android 12 visual

Jetpack Compose: get ready for 1.0 in July!

For the last few years, we’ve been hard at work modernizing the Android development experience, listening to your feedback to keep the openness–a hallmark of Android, but becoming more opinionated about the right way to do things. You can see this throughout, from Android Studio, a performant IDE that can keep up with you, to Kotlin, a programming language that enables you to do more with less code, to Jetpack libraries that solve the hardest problems on mobile with backward compatibility.

The next step in this offering is Jetpack Compose - our modern UI toolkit to easily build beautiful apps for all Android devices. We announced Compose here at Google I/O two years ago and since then have been building it in the open, listening to your feedback to make sure we got it right. With the Compose Beta earlier this year, developers around the world have created some truly beautiful, innovative experiences in half the time, and the response to the #AndroidDevChallenge blew our socks off!

With the forthcoming update of Material You (which you can read more about here), we’ll be adding new Material components as well as further support for building for large screens, making it fast and easy to build a gorgeous UI. We’re pressure testing the final bits in Compose and will release 1.0 Stable in July—so get ready!

Android Studio Arctic Fox: Design, Devices, & Developer Productivity!

Android Studio Arctic Fox (2020.3.1) Beta, the latest release of the official powerful Android IDE, is out today to help you build quality apps easier and faster. We have delivered and updated the suite of tools to empower three major themes: accelerate your UI design, extend your app to new devices, and boost your developer productivity. With this latest release you can create modern UIs with Compose tooling, see test results across multiple devices, and optimize debugging databases and background tasks with the App Inspector. We’re also making your apps more accessible with the Accessibility Scanner and more performant with Memory Profiler. And for faster build speeds, we have the Android Gradle plugin 7.0, new DSL, and variant APIs. You can learn more about the Android Studio updates here.

Android Studio Arctic Fox

Kotlin: the most used language by professional Android devs

Kotlin is now the most used primary language by professional Android developers according to our recent surveys; in fact, over 1.2M apps in the Play Store use Kotlin, including 80% of the top 1000 apps. And here at Google, we love it too: 70+ Google apps like Drive, Home, Maps and Play use Kotlin. And with a brand-new native solution to annotation processing for Kotlin built from the ground up, Kotlin Symbol Processing is available today, a powerful and yet simple API for parsing Kotlin code directly, showing speeds up to 2x faster with libraries like Room.

Android Jetpack: write features, not boilerplate

With Android Jetpack, we built a suite of libraries to help reduce boilerplate code so you can focus on the code you care about. Over 84% of the top 10,000 apps are now using a Jetpack library. And today, we’re unpacking some new releases for Jetpack, including Jetpack Macrobenchmark (Alpha) to capture large interactions that affect your app startup and jank before your app is released, as well as a new Kotlin Coroutines API for persisting data more efficiently via Jetpack DataStore (Beta). You can read about all the updates in Android Jetpack here.

Now is the time: a big step for Wear

The best thing about modern Android development is that these tools have been purpose built to help make it easy for you to build for the next era of Android, which is all about enabling devices connected to your phone–TVs, cars, watches, tablets–to work better together.

Starting today, we take a huge step forward with wearables. First, we introduced a unified platform built jointly with Samsung, combining the best of Wear and Tizen. Second, we shared a new consumer experience with revamped Google apps. And third, a world-class health and fitness service from Fitbit is coming to the platform. As an Android developer, it means you’ll have more reach, and you’ll be able to use all of your existing skills, tools, and APIs that make your mobile apps great, to build for a single wearables platform used by people all over the world.

Whether it’s new Jetpack APIs for Wear tailored for small screens and designed to optimize battery life, to the Jetpack Tiles API, so you can create a custom Tile for all the devices in the Wear ecosystem, there are a number of new features to help you build on Wear. And with a new set of APIs for Health and Fitness, created in collaboration with Samsung, data collection from sensors and metrics computation is streamlined, consistent, and accurate–like heart rate to calories to daily distance–from one trusted source. All this comes together in new tooling, with the release of Android Studio Arctic Fox Beta, like easier pairing to test apps, and even a virtual heart rate sensor in the emulator. And when your app is ready, users will have a much easier time discovering the world of Wear apps on Google Play, with some big updates to discoverability. You can read more about all of the Wear updates here.

Tapping the momentum of larger screens, like tablets, Chrome OS and foldables

When it comes to larger screens -- tablets, foldables, and Chrome OS laptops-- there is huge momentum. People are increasingly relying on large screen devices to stay connected with family and friends, go to school, or work remotely. In fact, there are over 250 million active large screen Android devices. Last year, Chrome OS grew +92% year over year–5 times the rate of the PC market, making Chrome OS the fastest growing and the second-most popular desktop OS. To help you take advantage of this momentum, we’re giving you APIs and tools to make optimizing that experience easier: like having your content resize automatically to more space by using SlidingpaneLayout 1.2.0 and a new vertical navigation rail component, Max widths on components to avoid stretched UIs, as well as updates to the platform, Chrome OS, and Jetpack windowmanager, so apps work better by default. You can learn more here.

Google Duo's optimized experience for foldable devices

Google Duo's optimized experience for foldable devices

This is just a taste of some of the new ways we’re making it easier for you to build high quality Android apps. Later today, we’ll be releasing more than 20 technical sessions on Android and Play, covering a wide range of topics such as background tasks, privacy, and Machine Learning on Android, or the top 12 tips to get you ready for Android 12. If building for cars, TVs, and wearables is your thing, we got that covered, too. You can find all these sessions - and more - on the I/O website. Beyond the sessions and news, there’s a number of fun ways to virtually connect with Googlers and other developers at this year’s Google I/O. You can check out the Android dome in I/O Adventure, where you can see new blog posts, videos, codelabs, and more. Maybe even test out your Jetpack Compose skills or take a virtual tour of the cars inside our dome!

Creating custom Tiles on Wear OS by Google with the Jetpack Tiles library

Posted by Jolanda Verhoef, Developer Relations Engineer

Wear OS header

We introduced Tiles in 2019, and since then, Tiles have become one of the most helpful and useful features on Wear OS by Google smartwatches. They are fast to access, convenient, and designed to provide users with swipeable access to the things they need to know and get done right from their wrist. This also gives users control over what information and actions they want to see.

Today, we're excited to announce that the Jetpack Tiles library is in alpha. This library enables developers to create custom Tiles on Wear OS smartwatches. These custom Tiles will become available to users later this Spring when we roll out the corresponding Wear OS platform update.

Wear OS interface

Tiles can be designed for many use cases, like tracking the user’s daily activity progress, quick-starting a workout, starting a recently played song, or sending a message to a favorite contact. While apps can be immersive, Tiles are fast-loading and focus on the user's immediate needs. If the user would like more information, Tiles can be tapped to open a related app on the watch or phone for a deeper experience.

Tile designs from Figma

Getting started

Tiles are built using Android Studio, as part of your Wear OS application. Start by adding the Wear OS Tiles dependencies:

dependencies {
  implementation "androidx.wear:wear-tiles:1.0.0-alpha01"
  debugImplementation "androidx.wear:wear-tiles-renderer:1.0.0-alpha01"
}

The first dependency includes the library you need to create a Tile, while the second dependency lets you preview the Tile in an activity.

Next, provide the information to render the Tile using the TileProviderService:

class MyTileService : TileProviderService() {
  override fun onTileRequest(requestParams: RequestReaders.TileRequest) =
    Futures.immediateFuture(Tile.builder()
      .setResourcesVersion("1")
      .setTimeline(Timeline.builder().addTimelineEntry(
         // For more information about timelines, see the docs
         TimelineEntry.builder().setLayout(
           Layout.builder().setRoot(
             Text.builder().setText("Hello world!")
           )
         )
      )
    ).build())

  override fun onResourcesRequest(requestParams: ResourcesRequest) =
    Futures.immediateFuture(Resources.builder()
      .setVersion("1")
      .build()
    )
}

There are two important parts to this code:

  • onTileRequest() creates your Tile layout. This is where most of your code goes. You can use multiple TimelineEntry instances to render different layouts for different points in time.
  • onResourcesRequest() passes any resources needed to render your Tile. If you decide to add any graphics, include them here.

Create a simple activity to preview your Tile. Add this activity in src/debug instead of src/main, as this activity is only used for debugging/previewing purposes.

class MainActivity : ComponentActivity() {
  override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    setContentView(R.layout.activity_main)
    val rootLayout = findViewById<FrameLayout>(R.id.tile_container)
    TileManager(
      context = this,
      component = ComponentName(this, MyTileService::class.java),
      parentView = rootLayout
    ).create()
  }
}

Now you’re ready to publish your Tile. For more information on how to do that, and to learn more about Tiles, read our new guide and take a look at our sample Tiles to see them in action.

The Jetpack Tiles library is in alpha, and we want your feedback to help us improve the API. Happy coding!

11 Weeks of Android: Beyond phones

Posted by Product Leads for Android TV, Android for cars, Wear OS, and Chrome OS

Android

This blog post is part of a weekly series for #11WeeksOfAndroid. Each week we’re diving into a key area of Android so you don’t miss anything. This week, we spotlighted Android Beyond Phones; here’s a look at what you should know.

With Android, people can experience the apps and services that they love across many devices & surfaces. Beyond phones, Android offers distinct yet familiar experiences on devices of all shapes and sizes, ranging from the smallest smartwatch screens, to larger displays on foldables and Chromebooks, to in-car entertainment systems, and all the way up to the largest television screens. For the past 4 days, we featured a daily deep dive into each of these exciting form factors that are providing developers with new and growing ways to engage people. Read on for a recap.

Android TV

We kicked off the week with Android TV, which is now partnering with 7 of the top 10 OEMs and over 160 television operators across the globe. The Android TV team highlighted 6 upcoming launches, like instant app trials right from Google Play and an updated Gboard, to help developers acquire more users, more easily monetize, and build even more engaging experiences. Then, new resources were published to help developers build their first Android TV app, or even go deep on new integrations like Cast Connect and frictionless subscriptions. If you’re excited about developing for TV, pick up an ADT-3, learn the latest from the training pathway, and bring your Android app to the biggest screen in the home!

Android for Cars

We shared new ways to reach more drivers on Android for cars. Android Auto, which allows you to connect your phone to your car display, is currently available with nearly every major car manufacturer and is on track to reach 100 million cars. Soon, new app categories including navigation, parking, and electric vehicle charging will be available and the experience for Android Auto users will become even more seamless as car manufacturers continue to add support for wireless connectivity. We also highlighted the launch of the first car powered by Android Automotive OS with Google apps and services built in — the Polestar 2. As more manufacturers ship cars with this embedded functionality, we’re making it even easier for developers to build media apps on Android Automotive OS with updated documentation and emulators. Get started today to bring your app to cars!

Large Screens

We covered large screens starting with the announcement of ChromeOS.dev — a dedicated resource for technical developers, designers, product managers, and business leaders. We’ve showcased our growth in device sales in Chrome OS, seeing Chromebook unit sales grew 127% year over year between March and June this year1, as well as some of the new features coming, such as customizable Linux Terminal and Android Emulator support. We’ve also continued to see growth in apps optimized for larger screen experiences, with over 1 million apps optimized for tablets and large screens available in the Google Play store. To help you develop the best-in-class apps for Chrome OS, foldables and tablets, we are continuing to release new features and updates. We released new design recommendations for your app as well as a few updates made in Android Studio. Check out the new sessions and some of the resurfaced content to learn more about bringing the best experiences to your users on these large-screen devices.

Wear OS

To round out the week, we talked about Wear OS where we are investing in the fundamentals with a focus on performance and faster app startup times, which you’ll see in the latest platform release coming in the fall. Wear OS will be launching updates to cornerstone features like Weather in the coming months, and is investing in helpful experiences, such as our recent hand-wash timer to help people maintain hand-hygiene in the Covid-19 pandemic. The team is working hard to bring the best of Android 11 to Wear OS.

Learning paths

Are you building your apps with different screen sizes and form factors in mind? Check out all the resources for Wear OS and Android for cars, and if you’re looking for an easy way to pick up the highlights of this week for Android TV and large screens, consider completing the pathway for each. These include codelabs, videos, articles and blog posts. A virtual badge is awarded to each user who passes the quiz.

We hope that you found the Android Beyond Phones week useful, and we're excited to see all the great experiences that you'll build on these platforms!

Resources

You can find the entire playlist of #11WeeksOfAndroid video content here, and learn more about each week here. We’ll continue to spotlight new areas each week, so keep an eye out and follow us on Twitter and YouTube. Thanks so much for letting us be a part of this experience with you!

Sources:
1 The NPD Group, Inc., U.S. Retail Tracking Service, Notebook Computers, based on unit sales, April–June 2020 and March–June 2020​.

11 Weeks of Android: Beyond phones

Posted by Product Leads for Android TV, Android for cars, Wear OS, and Chrome OS

Android

This blog post is part of a weekly series for #11WeeksOfAndroid. Each week we’re diving into a key area of Android so you don’t miss anything. This week, we spotlighted Android Beyond Phones; here’s a look at what you should know.

With Android, people can experience the apps and services that they love across many devices & surfaces. Beyond phones, Android offers distinct yet familiar experiences on devices of all shapes and sizes, ranging from the smallest smartwatch screens, to larger displays on foldables and Chromebooks, to in-car entertainment systems, and all the way up to the largest television screens. For the past 4 days, we featured a daily deep dive into each of these exciting form factors that are providing developers with new and growing ways to engage people. Read on for a recap.

Android TV

We kicked off the week with Android TV, which is now partnering with 7 of the top 10 OEMs and over 160 television operators across the globe. The Android TV team highlighted 6 upcoming launches, like instant app trials right from Google Play and an updated Gboard, to help developers acquire more users, more easily monetize, and build even more engaging experiences. Then, new resources were published to help developers build their first Android TV app, or even go deep on new integrations like Cast Connect and frictionless subscriptions. If you’re excited about developing for TV, pick up an ADT-3, learn the latest from the training pathway, and bring your Android app to the biggest screen in the home!

Android for Cars

We shared new ways to reach more drivers on Android for cars. Android Auto, which allows you to connect your phone to your car display, is currently available with nearly every major car manufacturer and is on track to reach 100 million cars. Soon, new app categories including navigation, parking, and electric vehicle charging will be available and the experience for Android Auto users will become even more seamless as car manufacturers continue to add support for wireless connectivity. We also highlighted the launch of the first car powered by Android Automotive OS with Google apps and services built in — the Polestar 2. As more manufacturers ship cars with this embedded functionality, we’re making it even easier for developers to build media apps on Android Automotive OS with updated documentation and emulators. Get started today to bring your app to cars!

Large Screens

We covered large screens starting with the announcement of ChromeOS.dev — a dedicated resource for technical developers, designers, product managers, and business leaders. We’ve showcased our growth in device sales in Chrome OS, seeing Chromebook unit sales grew 127% year over year between March and June this year1, as well as some of the new features coming, such as customizable Linux Terminal and Android Emulator support. We’ve also continued to see growth in apps optimized for larger screen experiences, with over 1 million apps optimized for tablets and large screens available in the Google Play store. To help you develop the best-in-class apps for Chrome OS, foldables and tablets, we are continuing to release new features and updates. We released new design recommendations for your app as well as a few updates made in Android Studio. Check out the new sessions and some of the resurfaced content to learn more about bringing the best experiences to your users on these large-screen devices.

Wear OS

To round out the week, we talked about Wear OS where we are investing in the fundamentals with a focus on performance and faster app startup times, which you’ll see in the latest platform release coming in the fall. Wear OS will be launching updates to cornerstone features like Weather in the coming months, and is investing in helpful experiences, such as our recent hand-wash timer to help people maintain hand-hygiene in the Covid-19 pandemic. The team is working hard to bring the best of Android 11 to Wear OS.

Learning paths

Are you building your apps with different screen sizes and form factors in mind? Check out all the resources for Wear OS and Android for cars, and if you’re looking for an easy way to pick up the highlights of this week for Android TV and large screens, consider completing the pathway for each. These include codelabs, videos, articles and blog posts. A virtual badge is awarded to each user who passes the quiz.

We hope that you found the Android Beyond Phones week useful, and we're excited to see all the great experiences that you'll build on these platforms!

Resources

You can find the entire playlist of #11WeeksOfAndroid video content here, and learn more about each week here. We’ll continue to spotlight new areas each week, so keep an eye out and follow us on Twitter and YouTube. Thanks so much for letting us be a part of this experience with you!

Sources:
1 The NPD Group, Inc., U.S. Retail Tracking Service, Notebook Computers, based on unit sales, April–June 2020 and March–June 2020​.

What’s happening in Wear OS by Google

Posted by Karen Ng, Director of Product and Robert Simpson, Product Manager

This blog post is part of a weekly series for #11WeeksOfAndroid. For each week, we’re diving into a key area and this week we’re focusing on Android Beyond Phones. Today, we’ll share what’s happening with Wear OS by Google.

Wearable technologies help people lead healthier lives and connect with important, timely information. Today, we're sharing our areas of investment focusing on the fundamentals, bringing even more helpful experiences to more watches, and giving users more choice in a device ecosystem.

Focusing on fundamentals

Wearables are designed to instantly connect people with what's important throughout the day. That's why we're focused on fundamentals like performance and power.

In the next OTA update coming in the fall, we’re improving performance by making it faster to access your info and start your apps. We’re simplifying the pairing process to make onboarding easier. You’ll see improvements to our SysUI for more intuitive controls for managing different watch modes and workouts. And with CPU core improvements, you’ll also see up to a 20% speed improvement in startup time for your apps.

Finally, we continue to support advancements in technology to bring new functionality, such as LTE, and expand levels of performance with the new Qualcomm® Snapdragon Wear™ 4100 and 4100+ platforms. We are excited by the kinds of wearable experiences that can be enabled in the future.

More helpful experiences

Wearables showcase important information at a glance. Some of the most used features of Wear OS by Google are hands-free timers and tracking fitness metrics. In response to COVID-19, we built a handwashing timer that helps ensure users practice good hygiene.

And later this year, you’ll see a beautiful new weather experience for Wear OS by Google. It aims to be easier to read while on the go, with an hourly breakdown of today’s weather to help you plan ahead and provide information about important weather alerts in your area.

Wearable OS image Wearable OS image Wearable OS image

We’re always imagining new ways wearables can help people stay healthy, present and connected. Stay tuned for more in 2021!

More choice than ever

We’re excited to welcome new watch OEMs to the Wear OS by Google family -- Oppo, Suunto, and Xiaomi. This means new watches that fit your style and needs -- such as the Suunto 7 with rich sports capabilities, or the new LTE watches from Oppo that will keep you connected on the go.

Bringing the best of Android to wearables

We’re also working to bring the best of Android 11 to wearables. Many of the things you’ve seen in modern Android development -- from Android Studio, a great language with Kotlin, and Jetpack libraries to make common tasks easier will be part of what you can expect as a developer building wearable apps. We’ve just released a release candidate for androidx.wear 1.1.0, and would love feedback on things you’d like to see as you get started building a wearable app.

We can’t wait to see what helpful experiences you’ll build!