Posted by Jason Tang, Product Management, Diego Zuluaga, Developer Relations, and Michael Mauzy, Developer Documentation
Since we introduced gesture navigation in Android 10, users have signaled they want to understand where a back gesture will take them before they complete it.
As the first step to addressing this need, we've been developing a predictive back gesture. When a user starts their gesture by swiping back, we’ll show an animated preview of the destination UI, and the user can complete the gesture to navigate to that UI if they want – as shown in the following example.
Although the predictive back gesture won’t be visible to users in Android 13, we’re making an early version of the UI available as a developer option for testing starting in Beta 4. We plan to make the UI available to users in a future Android release, and we’d like all apps to be ready. We’re also working with partners to ensure it’s consistent across devices.
Read on for details on how to try out the new gesture and support it in your apps. Adding support for predictive back gesture is straightforward for most apps, and you can get started today.
We also encourage you to submit your feedback.
To try out the early version of the predictive back gesture available through the developer option, you’ll need to first update your app to support the predictive back gesture, and then enable the developer option.
To help make predictive back gesture helpful and consistent for users, we're moving to an ahead-of-time model for back event handling by adding new APIs and deprecating existing APIs.
The new platform APIs and updates to AndroidX Activity 1.6+ are designed to make your transition from unsupported APIs (KeyEvent#KEYCODE_BACK and OnBackPressed) to the predictive back gesture as smooth as possible.
The new platform APIs include OnBackInvokedCallback and OnBackInvokedDispatcher, which AndroidX Activity 1.6+ supports through the existing OnBackPressedCallback and OnBackPressedDispatcher APIs.
OnBackInvokedCallback
OnBackPressedDispatcher
You can start testing this feature in two to four steps, depending on your existing implementation.
1. Upgrade to AndroidX Activity 1.6.0-alpha05. By upgrading your dependency on AndroidX Activity, APIs that are already using the OnBackPressedDispatcher APIs such as Fragments and the Navigation Component will seamlessly work when you opt-in for the predictive back gesture.
// In your build.gradle file:dependencies {
// Add this in addition to your other dependencies implementation "androidx.activity:activity:1.6.0-alpha05"
2. Opt-in for the predictive back gesture. Opt-in your app by setting the EnableOnBackInvokedCallback flag to true at the application level in the AndroidManifest.xml.
<application
...
android:enableOnBackInvokedCallback="true"
... >
</application>
If your app doesn’t intercept the back event, you're done at this step.
Note: Opt-in is optional in Android 13, and it will be ignored after this version.
3. Create a callback to intercept the system Back button/event. If possible, we recommend using the AndroidX APIs as shown below. For non-AndroidX use cases, check the platform API mentioned above.
This snippet implements handleOnBackPressed and adds the OnBackPressedCallback to the OnBackPressedDispatcher at the activity level.
val onBackPressedCallback = object: OnBackPressedCallback(true) {
override fun handleOnBackPressed() {
// Your business logic to handle the back pressed event
}
requireActivity().onBackPressedDispatcher
.addCallback(onBackPressedCallback)
4. When your app is ready to stop intercepting the system Back event, disable the onBackPressedCallback callback.
onBackPressedCallback.isEnabled = webView.canGoBack()
Posted by Kseniia Shumelchyk, Android Developer Relations Engineer
Today we’re launching version 1.0 of Compose for Wear OS, the first stable release of our modern declarative UI toolkit designed to help developers create beautiful, responsive apps for Google’s smartwatch platform.
Compose for Wear OS was built from the bottom up in Kotlin with assumptions of modern app architecture. It makes building apps for Wear OS easier, faster, and more intuitive by following the declarative approach and offering powerful Kotlin syntax.
The toolkit not only simplifies UI development, but also provides a rich set of UI components optimized for the watch experience with built-in support of Material design for Wear OS, and it’s accompanied by many powerful tools in Android Studio to streamline UI iteration.
The Compose for Wear OS 1.0 release means that the API is stable and has what you need to build production-ready apps. Moving forward, Compose for Wear OS is our recommended approach for building user interfaces for Wear OS apps.
Your feedback has helped shape the development of Compose for Wear OS; our developer community has been with us each step of the way, engaging with us on Slack and providing feedback on the APIs, components, and tooling. As we are working on bringing new features to future versions of Compose for Wear OS, we will continue to welcome developer feedback and suggestions.
We are also excited to share how developers have already adopted Compose in their Wear OS apps and what they like about it.
Todoist helps people organize, plan and collaborate on projects. They are one of the first companies to completely rebuild their Wear OS app using Compose and redesign all screens and interactions:
“When the new Wear design language and Compose for Wear OS were announced, we were thrilled. It gave us new motivation and opportunity to invest into the platform.”
“Huge improvement is how lists are created. Thanks to ScalingLazyColumn it is easier (compared to RecyclerView) to create scrolling screens without wasting resources. Availability of standard components like Chip helps saving time by being able to use pre-fabricated design-/view-components. What would have taken us days now takes us hours.”
The Outdooractive team also highlighted that Compose for Wear OS usage help them to strive for better app quality:
“Improved animations were a nice surprise, allowing smoothly hiding/revealing components by just wrapping components in “AnimatedVisibility” for example, which we used in places where we would normally not have invested any time in implementing animations.”
Another developer we’ve been working with, Period Tracker helps keep track of period cycles, ovulation, and the chance of conception.
Similarly to other developers, Period Tracker noted that Compose for Wear OS helped them to achieve better developer experience and improved collaboration with design and development teams:
“For example, before Chips components were available, we had to use a custom way to load images on buttons which caused a lot of adaptation work. Yes, Compose for Wear OS improved our productivity and made our designers more willing to design a better user experience on wearables.”
Check out the in-depth case studies to learn more about how other developers are using Jetpack Compose.
Let’s look into the key features available with 1.0 release:
Note that using version 1.0 of Compose for Wear OS requires using the version 1.2 of androidx.compose libraries and therefore Kotlin 1.7.0. Read more about Jetpack Compose 1.2 release here.
The declarative paradigm shift also alters the development workflow. The Compose tooling available in Android Studio will help you build apps more productively.
Android Studio Dolphin includes a new project template with Compose for Wear OS to help you get started.
The Composable Preview annotation allows you to instantly verify how your app’s layout behaves on different watch shapes and sizes. You can configure the device preview to show different Wear OS device types (round, rectangle, etc):
import androidx.compose.ui.tooling.preview
@Preview(
device = Devices.WEAR_OS_LARGE_ROUND,
showSystemUi = true,
backgroundColor = 0xff000000,
showBackground = true
)
@Composable
fun PreviewCustomComposable() {
CustomComposable(...)
Horologist is a group of open-source libraries from Google that supplement Wear OS development, which we announced with the beta release of Compose for Wear OS. Horologist has graduated a number of experimental APIs to stable including TimeText fadeAway modifiers, WearNavScaffold, the Date and Time pickers.
To learn more about Compose for Wear OS check out:
Now that Compose for Wear OS has reached its first stable release, it’s time to create beautiful apps built for the wrist with Compose!
Join the community
Join the discussion in the Kotlin Slack #compose-wear channel to connect with the team and other developers and share what you’re building.
Provide feedback
Please keep providing us feedback on the issue tracker and let us know your experience!
For more information about building apps for Wear OS, check out the developer site.
Posted by Jolanda Verhoef, Android Developer Relations Engineer
Today, we’re releasing version 1.2 of Jetpack Compose, Android's modern, native UI toolkit, continuing to build out our roadmap. This release contains new features like downloadable fonts, lazy grids, and improvements for tablets and Chrome OS with better focus, mouse, and input handling.
Compose is our recommended way to build new Android apps for phone, tablets and foldables. Today we also released Compose for Wear OS 1.0 - making Compose the best way to build a Wear OS app as well.
We continue to see developers like the Twitter engineering team ship faster using Compose:
“Compose increased our productivity dramatically. It’s much easier and faster to write a Composable function than to create a custom view, and it’s also made it much easier to fulfill our designers’ requirements.”
Compose 1.2 includes a number of updates for Compose on Phones, Tablets and Foldables - it contains new stable APIs graduated from being experimental, and supports newer versions of Kotlin. We've already updated our samples, codelabs, Accompanist library and MDC-Android Compose Theme Adapter to work with Compose 1.2.
Note: Updating the Compose Compiler library to 1.2 requires using Kotlin 1.7.0. From this point forward the Compiler releases will be decoupled from the releases of other Compose libraries. Read more about the rationale for this in our blog post on independent versioning of Jetpack Compose libraries.
Several features and APIs were added as stable. Highlights include:
LazyHorizontalGrid
LazyVerticalGrid
@Experimental
WindowInsets
windowInsetsPadding
systemBarsPadding
windowInsetsTopHeight
Modifier.nestedScroll
PointerEvent.scrollDelta
We’re continuing to bring new features to Compose. Here are a few highlights:
LazyLayout
Modifier.overscroll
GoogleFont
includeFontPadding
Brush
pluralStringResource
performKeyInput
Try out the new APIs using @OptIn and give us feedback!
@OptIn
We fixed a lot of issues raised by the community, most notably:
userScrollEnabled
TextField
EditText
We’re grateful for all of the bug reports and feature requests submitted to our issue tracker - they help us to improve Compose and build the APIs you need. Do continue providing your feedback and help us make Compose better!
Wondering what’s next? Check out our updated roadmap to see the features we’re currently thinking about and working on, such as animations for lazy item additions and removals, flow layouts, text editing improvements and more!
Jetpack Compose continues to evolve with the features you’ve been asking for. We’ve been thrilled to see tens of thousands of apps using Jetpack Compose in production already, and many of you shared how it’s improved your app development. We can’t wait to see what you’ll build next!
Happy composing!
Posted by Purnima Kochikar, VP of Partnerships, Google Play
This week we are celebrating ten years of Google Play. Over the past decade, your creativity combined with our investment in a global platform has created a thriving app ecosystem. 2.5 billion people in over 190 countries visit Play every month to connect with your apps and games, and Play has generated over $120 billion in earnings for developers to date. We’re so proud of this amazing milestone, and grateful for your partnership.
I joined the team in 2012, only a few months after Google Play launched. At that time, active users on Android had just grown from 100 million to 400 million. Android was the new kid on the block, with the audacious goal of making mobile computing accessible to everyone, everywhere. You were understandably skeptical about our chances for success - we were so far behind competing platforms in most aspects, from platform features and tools to design guidelines and commercial capabilities. Our belief in the immense potential of a fair and open ecosystem - and, even more importantly, our belief in your limitless potential - made us push forward. We were and continue to be driven by our commitment to your success.
Back then, our tiny partnerships team of just six people was figuring out how we could best support you in navigating the opportunities and challenges of the mobile economy. There were so many uncertainties: would we be able to deliver the apps you were envisioning to a global audience on devices they can afford? Would people watch videos on the small smartphone screens, given the high cost of mobile data and low device capabilities? Would they be happy paying for mobile games, and feel safe doing so? Would people subscribe to in-app content in the same way that they did to physical goods like magazines and newspapers?
We were with you every step of the way, taking the time to understand your needs and find ways to help you build beautiful apps and games. We also invited our global community of users to help us evolve your apps and games together, supported by features like beta testing and staged rollouts, and the ability to reply to user reviews.
Some of my fondest memories from those early days are of working with companies who inspired us by dreaming up novel ways to harness the magic of mobile phones. They broadened our perspective of what is possible. Smule is one of those early partners who kicked off their success in the first couple of years of Play. They became one of the first of many to inspire my team, and share their story with the community:
As your apps gained traction and you aspired to convert them into sustainable global businesses, we bolstered our investments in our commerce platform to help you grow and manage your business. We added the most popular and effective forms of payment from around the world to ensure people could pay for your apps and games frictionlessly. We removed complexities associated with finding and integrating local payment, including access to 300+ local payment methods supported in 70 countries. We also evolved our platform to anticipate and support your business needs - going from premium to free-to-play and subscriptions business models - and now Google Play helps consumers transact safely and seamlessly in more than 170 markets.
We provided industry leading insights through our Play Console on the entire lifecycle of your app, from installs to Vitals and more, to help you manage your business effectively. I remember my entire team tearing up when Vincenzo Colucci, the founder of Smart Launcher, described how Play enabled him to live where he wanted to live - in Manfredonia, in the South of Italy, with his loved ones - and do what he loves to do - build apps that impact people around the world. His company also turned 10 years old this year.
At every step, you demanded more from us and inspired us to think more expansively. In response, our product and engineering teams built tools and capabilities that could support all the great things that you were doing. Your feedback has helped to shape the launch of new features, resources and programs to support your success on the platform. With your help, we have evolved:
10 key launches from the decade
As your businesses matured, we invested in product capabilities such as Play Points to help you retain and re-engage your most loyal users. We are so proud that this program has over 100 million members in 28 countries, with further expansion scheduled for later this year. We also created a consulting service to provide business and technical insights to help you make more data driven decisions about your product roadmap and global expansion plans. You have told us that these insights have helped to drive millions in incremental revenues for you, and informed not only your product direction, but also your M&A strategies.
Above all, our partnership has brought meaningful apps and games to global audiences, and built successful businesses that have created new jobs and helped local economies. In the US alone, Play and Android have helped to create more than 2M jobs. We are truly proud of the economic impact we have had together on local communities and small businesses around the world.
As we look towards our next decade, it is useful to pause and reflect on the last two unprecedented years we have experienced together, and the overwhelmingly positive impact our partnership has had on the lives of so many people. Android and Play - powered by your businesses - have connected families and loved ones together, helped to keep people safe by supporting daily needs, sped up access to telemedicine, created employment, and enabled kids to learn and grow. Let’s take a moment to let that sink in.
These years have taught us important lessons about our joint responsibility to foster a safe and trusted ecosystem, and how much more needs to be done to make mobile accessible to everyone. As we think about the future, there are three areas which are top of mind of us:
The success of the founders who have gone through our Indie Game Festival and Accelerator programs, and the meaningful impact of our Change the Game initiative and of our accessibility efforts, make us optimistic about our ecosystem. We look forward to the next decade where we welcome many more founders like nine year old Alyssa and her mother who created Frobelles, a dress-up game increasing representation of African and Caribbean hair styles, to our #WeArePlay family.
Thank you for being an integral part of our audacious goal to make mobile accessible to everyone, everywhere. We have come a long way and we have a long way to go. We are inspired by and grateful for each one of you, and remain singularly committed to your success. We can’t wait to see what you will create next, and the new horizons you will drive us to explore and enable.
With gratitude,
Purnima Kochikar
Posted by Leticia Lago, Developer Marketing
We’re back with more #WeArePlay stories to celebrate you: the global community of people behind apps and games businesses.
Following last week’s “virtual roadtrip” of all of the US, today we’re kicking off with Melissa from Greenville, South Carolina. She’s on a mission to make the world a more pet-friendly place. Her app, BringFido, helps people find somewhere to stay, eat or visit with their furry friends. In this film you will meet her, her dogs Ace and Roxy, and hear how she went from idea, to website, to growing app and thriving business.
This week we are also introducing you to game founders from other parts of the world:
Arnaud, an AI-enthusiast from Chartres in France, who founded Elokence. This 12-people team created Akinator, which has been downloaded over 260 million times on Google Play.
Daigo, a creative indie from Japan, founder of Odencat, whose games have won multiple accolades.
Keerti and Kashyap, a cricket-loving couple from Hyderabad in India, who used their life savings to start Hitwicket Cricket Games. Millions of fans worldwide enjoy their games.
Check out all the stories now at g.co/play/weareplay and stay tuned for even more coming soon.
How useful did you find this blog post?
★ ★ ★ ★ ★
Posted by Maru Ahues Bouza, Director, Android Developer Relations
We’re just a few weeks away from the official release of Android 13! As we put the finishing touches on the next version of Android, today we’re bringing you Beta 4, a final update for your testing and development. Now is the time to make sure your apps are ready!
There’s a lot to explore in Android 13, from privacy features like the new notification permission and photo picker, to productivity features like themed app icons and per-app language support, as well as modern standards like HDR video, Bluetooth LE Audio, and MIDI 2.0 over USB. We’ve also extended the updates we made in 12L, giving you better tools to take advantage of tablet and large screen devices.
You can try Beta 4 today on your Pixel device by enrolling here for over-the-air updates. If you previously enrolled, you’ll automatically get today’s update. You can also get Android 13 Beta on select devices from several of our partners. Visit the Android 13 developer site for details.
Watch for more information on the official Android 13 release coming soon!
Today’s update includes a release candidate build of Android 13 for Pixel devices and the Android Emulator. We reached Platform Stability at Beta 3, so all app-facing surfaces are final, including SDK and NDK APIs, app-facing system behaviors, and restrictions on non-SDK interfaces. With these and the latest fixes and optimizations, Beta 4 gives you everything you need to complete your testing.
With the official Android 13 release just ahead, we’re asking all app and game developers to complete your final compatibility testing and publish your compatibility updates ahead of the final release. For SDK, library, tools, and game engine developers, it’s important to release your compatible updates as soon as possible -- your downstream app and game developers may be blocked until they receive your updates.
To test your app for compatibility, just install it on a device running Android 13 Beta 4 and work through the app flows, looking for any functional or UI issues. Review the Android 13 behavior changes for all apps to focus on areas where your app could be affected. Here are some of the top changes to test:
Remember to test the libraries and SDKs in your app for compatibility. If you find any SDK issues, try updating to the latest version of the SDK or reaching out to the developer for help.
Once you’ve published the compatible version of your current app, you can start the process to update your app's targetSdkVersion. Review the behavior changes that apply when your app targets Android 13 and use the compatibility framework to help detect issues quickly.
Android 13 builds on the tablet optimizations introduced in 12L, so as part of your testing, make sure your apps look their best on tablets and other large-screen devices. You can test large-screen features by setting up an Android emulator in Android Studio, or you can use a large screen device from our Android 13 Beta partners. Here are some areas to watch for:
You can read more about the tablet features in Android 13 and what to test here.
Today’s Beta 4 release has everything you need to test your app and try the Android 13 features. Just enroll your Pixel device to get the update over-the-air. To get started, set up the Android 13 SDK.
You can also test your app with Android 13 Beta on devices from several of our partners. Visit android.com/beta to see the full list of partners, with links to their sites for details on their supported devices and Beta builds, starting with Beta 1. Each partner will handle their own enrollments and support, and provide the Beta updates to you directly. For even broader testing, you can try Beta 4 on Android GSI images, and if you don’t have a device, you can test on the Android Emulator. For complete details on Android 13, visit the Android 13 developer site.
Watch for information on the official Android 13 launch coming in the weeks ahead! Until then, feel free to continue sharing your feedback through our hotlists for platform issues, app compatibility issues, and third-party SDK issues.
A huge thank you to our developer community for helping shape the Android 13 release! You’ve given us thousands of bug reports and shared insights that have helped us optimize APIs, improve features, fix significant bugs, and in general make the platform better for users and developers.
We’re looking forward to seeing your apps on Android 13!