Tag Archives: Android Developer

Tips from Android Dev Summit 2022: How to scale made-for-mobile apps to ChromeOS

Posted by Patrick Fuentes, Developer Relations Engineer, Google ChromeOSPeople’s appetite for apps on larger screens is growing fast. In Q1 2022 alone, there were 270 million active Android users across Chromebooks, tablets, and foldables. So if you want to grow reach, engagement, and loyalty, taking your app beyond mobile will unlock a world of opportunity.

If your app is available in Google Play, there’s a good chance users are already engaging with it on ChromeOS. And if you’re just starting to think about larger screens, tailoring your app to ChromeOS — which runs a full Android framework — is a great place to start. What’s more is that optimizing for ChromeOS is very similar to optimizing for other larger-screen devices, so any work you do for one will scale to the other.

At Android Dev Summit 2022, I shared a few ChromeOS-specific nuances to keep in mind when tailoring your app to larger screens. Let’s explore the top five things devs should consider, as well as workarounds to common challenges.

1) Finessing input compatibility

One of the biggest differences between user behavior on mobile and larger-screen devices is people’s preference for input devices. About 90% of ChromeOS users interact with apps using a mouse and keyboard, and Android users across tablets and foldables often do the same.
About 90% of ChromeOS users interact with apps using a mouse and keyboard
The first step to meeting people’s expectations is testing your app’s support for a keyboard, mouse, and stylus. Once you’ve got your basics covered, you can add enhancements such as thoughtful focus states and context menus. You can also further enhance input compatibility on larger screens by testing app-specific input devices, such as game controllers.
Focus states and context menus shown on Chromebooks

2) Creating a fit-for-larger-screen UI

People freely resize apps on ChromeOS, so it’s important to think about how your app looks and feels in a variety of aspect ratios — including landscape orientations. Although ChromeOS offers automatic windowing compatibility support for made-for-mobile experiences, apps that specifically optimize for larger screens tend to drive more engagement.

The extra screen real estate on Chromebooks, tablets, and foldables gives both you and your users more room to play, explore, and create. So why not make the most of it? You can implement a responsive UI for larger screens with toolkits such as Jetpack Compose and create adaptive experiences by sticking to design best practices.


3) Implementing binary compatibility

If you’ve exclusively run your app on Android phones, you might only be familiar with ARM devices. But Chromebooks and many other desktops often use x86 architectures, which makes binary support critical. Although Gradle builds for all non-deprecated ABIs by default, you’ll still need to specifically account for x86 support if your app or one of your libraries includes C++ code.

Thanks to binary translation, many Android apps will run on x86 ChromeOS devices even if a compatible version isn’t available. But this can hinder app performance and hurt battery life, so it’s best to provide x86 support explicitly whenever you can.


4) Giving apps a thorough test run

The surefire way of ensuring a great user experience? Run rigorous checks to make sure your apps and games work as expected on the devices you’re optimizing for. When you’re building for ChromeOS, testing your apps on Chromebooks or another larger-screen device is ideal. But you've still got options if a physical device isn’t available.

For instance, you can still test a keyboard or mouse on an Android handset by plugging them into the USB-C port. And with the new desktop emulator in Android Studio, you can take your app for a spin in a larger-screen setting and test desktop features such as window resizing.

A Chromebook featuring the Desktop Android Virtual Device in Android Studio

5) Polishing apps for publishing

Sometimes, even apps tested on Chromebooks — and listed in Google Play — aren’t actually available to ChromeOS users. This usually happens because there’s an entry in the app’s manifest declaring it requires features that aren’t available on the unsupported device.

Let’s say you specify your app requires “android.hardware.camera.” That entry refers to a rear-facing camera — so any devices with only a user-facing camera would be considered unsupported. If any camera will work for your app, you can use “android.hardware.camera.any” instead. And if a hardware feature isn’t a must for your app, it’s best to specify in your manifest that it’s not required by using “required=false.”

A Chromebook featuring recommended manifest entries for hardware features. These manifest entries are also featured on their own next to the Chromebook
Once you’ve got your manifest squared away, your app is ready to ship. Your app listing is often your first chance to impress and attract users. That’s why we’re excited the Play Console now enables you to upload screenshots specific to different form factors. With this new functionality, you can show off what your app experience is like on users’ favorite devices and entice them to download.


Connect with millions of larger-screen users

As people’s love for desktops, tablets, and foldables continues to grow, building for these form factors is becoming more and more important. Check out other talks from Android Dev Summit 2022 as well as resources on ChromeOS.dev and developer.android.com for more inspiration and how-tos as you optimize for larger screens. And don’t forget to sign up for the ChromeOS newsletter to keep up with the latest.

Purchase optimization, flexible subscriptions, and revenue growth with Play Commerce

Posted by Jian Zhou, Director of Engineering, Google Play CommerceGoogle Play Commerce provides buyer support in over 190 markets, extensive support for local payment methods, and monetization tools to increase buyer conversion, engagement, and retention – all built on our trusted and secure platform. This year, we’ve made improvements across our platform, with new purchase optimizations, more flexibility and control when selling subscriptions, and enhancements to monetization insights and programs aimed at boosting your revenue.

Smoother, more frictionless purchase experience

Google Play offers users a consistent, familiar purchase experience, and over the past year we’ve launched two major new features to make in-app purchases even more frictionless.

  • Multi-quantity purchases allow your users to purchase more than one of a popular item with ease. You can configure which products are eligible for multi-quantity directly in Play Console to let users easily select the quantity they want to purchase directly in the cart.
    Screenshot of phone screen showing multi-quantity purchasing capability in Google Play
    Implement multi-quantity purchases to allow users to easily purchase more than one item at a time.
  • We are also improving the experience for purchases made by supervised accounts, and users will start seeing this update rollout this month. Parents or “the family manager” can now make app & in-app purchases for their child without requiring to set up a family payment method.
For example, when a child account attempts to make a purchase in your app without a family payment method set up, instead of prompting them to ask the family manager to set one up, a purchase request is sent to the family manager who can complete the purchase with any payment method on their profile, including gift cards. If preferred, the family manager still has the option to set up a family payment method.
Screenshot of four phone screens showing child request purchase and parent approve & buy capability in Google Play
Parents can now easily approve purchases requested by child accounts with their own profile without needing to set up a family payment method.



More flexible subscriptions to improve reach, conversion, and retention

Digital subscriptions continue to be one of the fastest-growing ways for developers to monetize on Google Play, so we reimagined the developer experience and added new tools to give you more flexibility and control when it comes to growing and retaining your subscribers.

  • New subscription capabilities separate your subscription products – what you sell – from how you sell them, allowing you to configure multiple base plans and offers for each subscription. This can help you reduce operational costs by eliminating the need to create and manage an ever-increasing number of SKUs.

    In the past, multiple billing durations and special offers were each defined as fully independent SKUs. If multiple SKUs provided the same benefits with different combinations of billing periods or pricing, this quickly became complex.

    Diagram of Old and New models showing subscription tiers in Google Play
    New model separates your subscription products – what you sell – from how you sell them

    Check out the video below and take our Play Academy course to learn more about configuring base plans and offers for your subscription, including offering prepaid plans that allow users access to pay a fixed amount of time, and then top-up as desired. If you haven’t yet integrated, check out this guide, documentation, and sample app to get started.

  • We also launched In-App Messaging, a new way to retain more subscribers following a declined payment. Simply call the In-App Messaging API when a user opens the app, and if the user’s payment has been declined, they will be prompted to update their payment information.
~2X Subscription recovery when users saw the message* Moving image showing In App Messaging API in Google Play
*Based on experiments with early users
  • Another way to improve retention is by adding benefits describing your subscription in Play Console. Benefits can remind users of the value they get from your subscription at key moments, such as when the user comes to manage their subscription on Play.
Screenshot of a phone screen displaying app benefits in the Cancel screen in Google Play
Add benefits descriptions to remind users of the value received from your subscription

Monetization insights and programs to boost your revenue

Ensuring your app or game’s monetization strategy reaches its full revenue potential is an important focus for us. This year we’ve launched a new monetization insights tool and continued to invest in programs that can complement your strategy.

  • We realize how important it is to contextualize which metrics drive your topline revenue and which lower-level metrics can be further optimized to maximize your game’s revenue. Strategic guidance provides a visual metric hierarchy in Play Console of how your game’s revenue metrics impact your business goals and helps you to identify which metrics to prioritize, as well as opportunities to optimize a chosen metric by providing peer group benchmarks, country breakdowns, and trends. Check out the video below to learn more about strategic guidance and how its metric-specific recommendations can help transform insights into action.

  • Google Play Points is another way to boost your revenue. Since launch, over 100 million members have joined the program! This year, those members have invested over billions of earned points into titles, increasing revenue on average between 5% and 30% for participating developers. Play Points has expanded to over 30 markets, including this year’s launches for users in India, Mexico, Czech Republic, and Poland. We’ve also added the ability to track Points coupon and out of app product transactions through financial reports in Play Console.
  • Google Play Pass is a great way to complement your app or game’s monetization strategy - already featuring 1,100+ titles from over 500 developers. For Play Pass participating titles, we’ve seen Play revenue nearly double on average. Play Pass is now available in 92 markets, including expansion to two new key markets this year: India and Japan. We’ve also added over 200 new apps and games to our catalog this year and continue to invest in Play Pass’s growth by investing $2 million in local game studios, with our first Indie Games Fund in LATAM.

Screenshot of a phone screen showing Google Play Passs in Google Play

All these features and tools are now available on Google Play. To take full advantage of In-App Messaging, prepaid plans, and the new subscription capabilities, update to Play Billing Library 5.0 or newer. As we continue to invest in Play Commerce, we look forward to expanding your buyer reach and developing new monetization tools to help you grow your business.

Supporting and rewarding great Apps and Games on Google Play

Posted by Tom Grinsted, Group Product Manager, Google Play

Supporting and rewarding great Apps and Games on Google Play

At Google Play, our mission is to facilitate relationships between Android users and app and game developers, enabling tens of thousands of businesses worldwide to grow and thrive in the mobile ecosystem. Every day, together, we help billions of people discover engaging, helpful, and enriching experiences on their devices, which is why we care so deeply about the quality of the experience we offer on the Play Store.

To do that, we’re constantly developing new ways to promote and support high-quality titles throughout the entire lifecycle, from acquisition and engagement to retention and reacquisition. Over the coming months, we’re rolling out enhancements to Google Play and Google Play Console that embed your key events, content, and offers across the Google Play experience. These changes are designed to help you reach more people, improve discovery of higher-quality titles, and optimize your presence for the greatest possible impact.

To help you navigate these updates, we’re sharing our key thinking and direction early, and launching new features to help power your growth across your users’ lifecycle with you. So read on!

Powering developer success across the lifecycle

As a partner, we’re focused on helping developers succeed. In today's app ecosystem, where loyalty and re-engagement are more top of mind than ever before, we’re creating even more opportunities for developers to use our surfaces to not only find first-time users but also to engage, and re-acquire them. 

For select titles, LiveOps is a key channel to reach users directly on Google Play with great offers, launches, and events. LiveOps has helped titles like Rise of Kingdoms, Paramount+, and MyFitnessPal add exciting new content that inspire discovery, re-engagement, and monetization. On average, developers using LiveOps drive +3.6% increase in revenue and a +5.1% increase in 28DAU versus similar titles who don’t. Individual events are already garnering compelling uplifts from Play.

ALT TEXT
Play data: additional growth by a real LiveOp
 Analysis: 90th percentile of over 70 recently run liveOps vs. control groups with 0.9 confidence interval

To accelerate this performance, over the coming months we’re expanding how your content is used on Google Play by creating new high-impact placements and formats. It will become deeply integrated into users’ experiences, from their homepages, through search and discovery, in your title’s listings, and directly into your apps via deep links.
ALT TEXT
New content formats will help users discover and rediscover high-quality content to enjoy. Final design may vary.

To help you take full advantage of the opportunity that content on Play presents, we’re making key changes in Play Console. These start with the renaming of LiveOps to “Promotional Content.” This reflects the breadth of content you can submit to Play today, and new content types we’ll be adding over time. We’ve also updated format guidelines, priority quotas, and now enable bulk data downloads. If you're one of the thousands of titles that already use Promotional Content, look for messages in your Play Console Inbox to find out more. We're looking to expand access to even more apps and games next year.

These changes bring even more opportunities to leverage your events to grow your active audience and revenue. Visibility and promotion across Play are also dependent on the quality of your title and individual content. So make sure you check our updated content guidelines and recommendations.

Driving reacquisitions

Another key part of the lifecycle is bringing back users who’ve tried your title before. As mobile ecosystems continue to mature and developers continue to invest for the long-term, this growth channel is only getting more important.

That’s why we’re introducing Churned-user Custom Store Listings. These enable you to tell a different story to users on Play who’ve tried but uninstalled your apps or games before. Because our store listings power experiences like the overlay you see when interacting with an app ad on YouTube, your custom re-acquisition messages can be seen by users across different Google surfaces.

Over the coming months, we will also look at how Google Play can help enable more reacquisition for great, high-quality titles. Churned-user Custom Store Listings will begin rolling out towards the end of this year and you can express your interest in being one of the first to use them by filling out this form.

Caring about quality - driving acquisitions for high-quality apps and games

We focus on crafting exciting and fresh journeys for users on Play. Among other signals, quality evaluation factors in our teams’ judgements and editorial decisions. Users expect great experiences, and we aim to support titles that deliver on their expectation which is why quality is a key aspect of discovery.

First, we consider in-app quality. We look at a range of factors including: Does your title have a polished design, and content that keeps users engaged for the long term? Is your onboarding experience clear, and are any ads well-integrated? Does your title have intuitive navigation, controls, and menu access? Do you meet the guidelines for functional behavior across all the form factors that you support? And is your title accessible to all users?

Technical quality is another important consideration. It can differ greatly depending on user and device, so we're introducing new more user-focused crash and ANR metrics in Android vitals. These will increasingly influence Play Store treatments—steering users away from titles that are likely to provide a poor experience on their specific devices, and towards ones that may be more suitable. In some cases, a warning could be displayed on store listings.

ALT TEXT
Users may see a store listing warning if a title has a user-perceived crash rate or user-perceived ANR rate above 8% on their phone model starting November 30, 2022. Note that final design and text is subject to change.

We’ll warn you in Android vitals if there’s a risk that your app will get this treatment before it’s visible in Play, so you can take remedial action. Please read our App Quality blog post to learn more.

Finally on the topic of quality, we’re setting a minimum ratings bar of 3.0 stars to improve top charts. We will first launch the ratings change to Top Free charts worldwide and across all form factors in February 2023. Later next year, we plan to bring this change to top paid and grossing charts as well.

Play Console has tools for you to triage your rating, deep dive into top issues users are writing about and respond to reviews directly. Find out more here.

Being transparent about our contributions

As we continue to make Play an even more valuable platform for developers, we want to make sure that you can see the positive impact our surfaces have on your growth. So we’re updating Store Performance reports to better reflect how users discover your titles on Play. This includes more data from off-Play experiences, differentiating paid-for and direct traffic from users’ organic behavior on Play, and the inclusion of key discovery journeys - for instance, searching for categories like ‘Puzzle Games’ - in Explore traffic. Coming soon, we’ll send you a message in Play Console when this update goes live.

All of these changes, along with other exciting features we have in the works, work together. So if you’re invested in the quality of your experiences, evolving your offer, and crafting exciting events and compelling content, Play is the platform and partner to super-charge your growth and success.

Keeping Google Play Safe with New Features and Programs

Posted by Ron Aquino, Senior Director, Trust and Safety, Chrome, Android and Play

Google Play has been the launchpad for millions of developer businesses to connect with consumers around the world as we strive to deliver a safe place to find great apps and games. Our safety initiatives and policies are core ways that we create the trusted experience that users have come to expect. By responsibly evolving these features, policies, and programs, we’re able to help you safely launch new experiences to more than 2.5 billion users in 190 countries around the world.

Today, we’re sharing a number of new features and programs to better partner with you and continue making Google Play a safe platform for everyone.


Protecting your business and your users from risky, unknown traffic

We launched Play Integrity API to all developers earlier this year to help you detect risky, unknown interactions such as from tampered versions of your app or unsupported app environments. You call this API when a user performs an action in your app to check whether it’s your genuine app on a genuine Android device. If something’s off, you can decide what defensive actions to take. Early data show that this feature has helped developers reduce unauthorized usage of their apps by over 50%.

In addition to customizing your API responses and setting up tests in Play Console, we’re launching reporting so you can analyze and break down API responses across your install base. And, soon, you’ll be able to debug Integrity API responses from the Play Store app’s developer settings on any device. This will help you spot issues and refine your anti-abuse strategy. Get started today with the Play Integrity API here.

Introducing new protections against review attacks on Play apps

For you to grow successful businesses and for users to have trustworthy information to help them decide if an app is right for them, it’s critical that app reviews are accurate, relevant, and genuine. Earlier this year, we rolled out a more aggressive program to proactively stop inaccurate, coordinated user attacks on app ratings. Our strengthened system now better detects anomalies and unexplained spikes in low star ratings so that our team can quickly investigate suspicious activity and respond to it. Since this program launched at the start of this year, we have had no major review attacks that materially impacted the ratings of top-downloaded apps. We’ve continued to strengthen the program further by introducing a mandatory 24-hour-delay of all incoming app reviews. Play is also exploring ways to evolve our policy to help ensure the content of app reviews is relevant to the app experience and further elevate trustworthy information on our platform. We'll have more to share soon.



Expanding our program to give developers direct Play Policy support

While we help developers understand our policy changes through a variety of communications and trainings, we heard that you want more direct policy support from Google. Early last year, we started our Google Play Developer Helpline pilot to explore giving developers direct policy support over the phone. By the first half of 2021, we scaled the pilot to 12,000 developers in India and since then, we’ve expanded this offering to 44,000 developers in 17 countries. Today, the Helpline program has completed nearly 4,000 policy support sessions with developers and received a satisfaction score of around 90%. So far, this program has helped developers navigate policy compliance issues. We look forward to further scaling the program to many more of you soon.


Launching the Strike Removal pilot program

Beyond expanded policy support, we also introduced a new program this year to provide developers deeper education on important but commonly misunderstood policy areas. We know that most developers work hard to create and distribute their apps with good intentions, and may sometimes unknowingly violate policies. The Play Strike Removal pilot program provides the opportunity for you to remove an enforcement strike by successfully taking a Play Academy training course and assessment related to the policy violation. We’ve started this program with courses on IP Infringement and Spam policy violations, which account for nearly 2 out of 3 developer suspensions. We hope to add more courses in the future to help you better understand the policies that keep Play safe.


Previewing a more privacy-friendly approach to advertising

As a reminder, Privacy Sandbox for Android is a multi-year initiative to create innovative technologies that will both protect user privacy and give you tools to build thriving digital businesses. These solutions aim to make current tracking mechanisms obsolete and limit covert tracking techniques, like fingerprinting. To do this, we're working on core advertising capabilities that don’t need access to cross-app identifiers, like the Ad ID. You'll be able to use these solutions individually or together to target ads and measure them to create efficient campaigns, all while better protecting user privacy. We’re working in close partnership with the industry and developers. Today, you can test Developer Previews, begin designing integrations, and send us feedback.As a platform, we only succeed when our developers succeed. We work with partners, like you, every day to understand the challenges you face, help launch innovative apps to Google Play, and ensure that the apps remain safe and trusted by our shared users. Thank you for your partnership in making Google Play a safe and trustworthy platform for everyone.

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!

Prepare your app to support predictive back gestures

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.

Try out the predictive back gesture in Beta 4

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.

Update your app to support predictive back gesture

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.

You can start testing this feature in two to four steps, depending on your existing implementation.

To begin testing this feature:


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 = objectOnBackPressedCallback(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()



Note: Your app may require using the platform APIs (OnBackInvokedCallback and OnBackPressedDispatcher) to implement the predictive back gesture. Read our documentation for details.

Enable the developer option to test the predictive back gesture

Once you’ve updated your app to support the predictive back gesture, you can enable a developer option (supported in Android 13 Beta 4 and higher) to see it for yourself.

To test this animation, complete the following steps:
  1. On your device, go to Settings > System > Developer options.
  2. Select Predictive back animations.
  3. Launch your updated app, and use the back gesture to see it in action.

Learn more

In addition to our detailed documentation, try out our predictive back gesture codelab in an actual implementation.

If you need a refresher on system back and predictive back gesture on Android, we recommend watching Basics for System Back.


Thank you again for all the feedback and being a part of the Android Community - we love collaborating together to provide the best experience for our users.

Now in Android – a new, open source, real-world sample app

Posted by Paris Hsu, Product & Design, Android and Don Turner, Developer Relations Engineer, Android

Now in Android Splash logo

The Now in Android app is now on GitHub!

For two years, 'Now in Android' has been a popular blog and YouTube series, providing you with the latest and greatest developer news from the Android team. Starting today, you can check out the alpha version of the Now in Android app on GitHub! ?

The app has two goals:

Firstly, it showcases best practices, opinionated designs, and solutions to complex real-world problems which other sample apps don’t handle. It does so with an open source implementation of a real world app.

Secondly, it helps you (the developer) keep up to date with the areas of Android development which interest you most. It is a working app planned for publication on the Play Store.

image of Now in Android app screen designs on three phones

Now in Android app screen designs

For this first alpha release, the Now in Android app includes:

As well as these features, we are also documenting the learning journeys we took to certain decisions with the app's design and implementation. Check out our first journey on the app's Architecture here.

image showing how the Now in Android app adapts based on device screen size

The Now in Android screens adapt based on device screen size

Since this is an alpha release, we expect that there will be bugs and missing features, and we would greatly appreciate your feedback. We have some exciting features planned, such as user authentication and loading data from a real backend. We can’t wait for you to check out the app and let us know what you think!

Finally, if you want to learn about the tools we used to build the app and how we target multiple screen sizes, check out these talks from this year's Google I/O:

Android Studio Bumblebee (2021.1.1) Stable

Posted by Adarsh Fernando, Product Manager, Android

Bumblbee Android Studio

The Android Studio team has been abuzz with the stable release of Android Studio Bumblebee (2021.1.1) ? and Android Gradle plugin (AGP) 7.1.0; the latest versions of Android official IDE and build system. We’ve improved functionality across a broad area of the typical developer workflow: Build and Deploy, Profiling and Inspection, and Design.

Some notable additions include a unified test execution between Android Studio and your continuous integration (CI) server ✅, convenient pairing flows to support ADB over Wi-Fi ?, Improved Profiler tools to help you identify and analyze jank in your app ?️, and new ways to preview animations ? and UI interactions without deploying your app to a device.

As always, this release wouldn’t be possible without the early feedback from our Preview users. So read on or watch below for further highlights and new features you can find in this stable version. If you’re ready to jump in and see for yourself, head over to the official website to download Android Studio Bumblebee (2021.1.1).


What’s in Android Studio Bumblebee (2021.1.1)

Below is a full list of new features in Android Studio Bumblebee (2021.1.1), organized by the three major themes.

Build and Deploy

  • New Device Manager: This new tool window in Bumblebee makes it easier to see and manage your virtual and physical test devices, and you can open it by selecting View > Tool Windows > Device Manager from the main menu bar. In the Virtual tab, create a new device, review device details, delete a device, or anything else you used to do from the now removed AVD Manager. In the Physical tab, quickly pair to a new device using ADB Wi-Fi and see details of each physical device at a glance, or quickly inspect each device’s file system using the Device File Explorer with a click of a button. Learn more about the New Device Manager in the release notes.
Device Manager

Device Manager


  • ADB over Wi-Fi: Bumblebee includes a simplified flow to connect to your Android 11 and higher devices over Wi-Fi for deployment and debugging using ADB. After you enable debugging over Wi-Fi on your device, select the Pair using Wi-Fi action in the Physical tab of the new Device Manager to open the pairing wizard. Then follow the steps provided to pair to a device connected over the same network. Learn more.
Pairing a device with ADB over Wifi

Pairing a device with ADB over Wifi


  • Run Instrumented Tests in Android Studio using Gradle: Have you ever run tests in Android Studio with different results than the same tests running on your CI? This can be a frustrating issue that leads to lost productivity. To resolve this issue, we’ve introduced a new test runner to Android Gradle plugin (AGP) 7.1.0 that Android Studio Bumblebee uses by default when running instrumentation tests, so all your tests run through a unified test runner. This is a similar improvement to Android Studio Arctic Fox, where we started running all unit tests via Gradle by default. And, similarly, this improvement doesn’t require you to change how you write or run your tests!

Using different runners lead to inconsistent results

Using different runners lead to inconsistent results


Android Studio now runs instrumentation tests via Gradle

Android Studio now runs instrumentation tests via Gradle


  • Android Gradle Plugin Upgrade Assistant now updates API usage: Originally introduced in Android Studio 4.2, the AGP Upgrade Assistant helped users update their projects to the latest version, and improvements in Arctic Fox provided a new UI with the ability to review and select the upgrade version and steps. In Bumblebee, the Upgrade Assistant now also checks for and offers to update your DSL to help you avoid using deprecated APIs before they are deleted. For more information see the Android Gradle Plugin DSL/API migration timeline.
  • Non-Transitive R classes on for new projects: Android Studio Arctic Fox introduced new refactoring tools to help you use non-transitive R classes to enable faster builds for applications with multiple modules. When creating new projects using Bumblebee, the IDE configures your project to use non-transitive R classes, by default. While this does bring performance improvements, you now have to refer to R classes by their proper package name, and not by the package names of their parent modules, as they will no longer resolve transitively. For more information see Use non-transitive R classes.
  • Emulator tool window enabled by default: Introduced in Android Studio 4.1, the Emulator launches within an Android Studio tool window and allows you to deploy and interact with virtual Android devices while fully remaining within the context of the IDE. The changes ads an improved UX for extended controls and snapshot management. For more information see Run the Android Emulator directly in Android Studio.
  • Apple Silicon Support Update - For those using macOS on Apple Silicon (arm64) hardware, Android Studio Arctic Fox and the Android Emulator have supported this new architecture since last year. However, with this release, we have now updated the Android SDK platform tools v32.0.0 (which includes ADB and fastboot) and build tools v32.1.0 (which includes aapt) to be universal binaries so that your Android developer tools no longer need the Rosetta binary translator to run. Based on community feedback, those developers on this hardware platform have seen notable performance improvements. See release notes.


Profile and Inspect

  • Jank detection track in Profilers: When profiling your app using devices running Android 11 (API level 30) or higher, the CPU profiler now shows a new group of tracks that illustrate the stages of each frame under Frame Lifecycle: Application, Wait for GPU, Composition and Frames on display. Each track labels the frames with a frame number and color-codes the rectangle to make it easy for you to visualize where a particular frame is in its lifecycle, along with guides you can toggle to compare with Vsync events. You can use this data to understand where Jank might occur in your app and investigate the root causes. In the Analysis panel, there is now a Frames tab, which conveniently summarizes rendering information for all frames. For more information, see UI jank detection.

Detailed frame lifecycle information in the CPU Profiler

Detailed frame lifecycle information in the CPU Profiler


  • Profileable app profiling support in Studio Profilers: When profiling your app, it’s important to generate accurate data with the version of your app that most closely resembles what your users will install. To do so, you can now include the <profileable> property in your app’s manifest to profile apps that are not debuggable, as shown below.

    <profileable android:shell="true"/>

    Profileable is a manifest configuration introduced in Android 10, and is available for CPU and Memory profiling tasks. Using the profileable flag instead of the debuggable flag has the key advantage of lower overhead for performance measurement; however, certain profiling features are not available for Profileable builds, such as the Event timeline, API initiated CPU profiling, heap dumps, or live location recordings. For more information, see Profileable applications.
  • Inspect Jobs, Alarms, and Wakelocks: The Background Task Inspector has been expanded to allow you to inspect Jobs, Alarms, and Wakelocks. You can see live information on how these background tasks are being scheduled, and see detailed information about their execution, similar to how you can inspect Workers. Additionally, when inspecting Workers, you can track and inspect Jobs that your Workers schedule for you. If you used to use the Energy Profiler in previous versions of the IDE, you should now navigate to View > Tool Windows > App Inspection from the menu bar and select the Background Task Inspector to inspect Jobs, Alarms, and Wakelocks.

Inspect Jobs, Alarms, and Wakelocks in the Background Task Inspector

Inspect Jobs, Alarms, and Wakelocks in the Background Task Inspector


  • Network Inspection: The Network Profiler has now migrated to the App Inspection tool window, to allow for a lighter-weight experience for inspecting network traffic in your app. The look and feel of the Network Profiler has been maintained and works with any debuggable app on devices running API level 26 and higher. To use the new inspector, select View > Tool Windows > App Inspection from the menu bar and select the Network Inspector. For more information, see Inspect network traffic with the Network Inspector.
  • Capture Layout Inspector snapshots: You can now capture snapshots of your app’s layout hierarchy to save, share, or inspect later. Snapshots capture the data you would typically see when using the Layout Inspector, including a detailed 3D rendering of your layout, the component tree of your View, Compose, or hybrid layout, and detailed attributes for each component of your UI. When inspecting the layout of a live running app, click Export snapshot from the Layout Inspector toolbar and save the snapshot with an *.li extension. You can then load a Layout Inspector snapshot by selecting File > Open from the main menu bar, and opening a *.li file. The snapshot appears in a tab in the Editor window, so that you can easily compare it with your running app. Learn more at Capture layout hierarchy snapshots.

GIF  
  • Support for Compose semantics in the Layout Inspector: In Compose, Semantics describe your UI in an alternative manner that is understandable for Accessibility services and for the Testing framework. In Android Studio Bumblebee, you can now use the Layout Inspector to inspect semantic information in your Compose layouts. When selecting a Compose node, use the Attributes window to check whether it declares semantic information directly, merges semantics from its children, or both. To quickly identify which nodes include semantics, either declared or merged, use select the View options dropdown in the Component Tree window and select Highlight Semantics Layers.

Design

  • Interactive Preview: Android Studio Arctic Fox launched with support to statically preview your composable functions in the Design / Split window of the Editor. In Bumblebee, we’ve expanded functionality to allow you to interact with certain components of your Compose layouts, to validate behavior without building and deploying the full app to a running device! To get started, navigate to a previewable compose function and click Start Interactive Mode in the Design / Split window. For more information see Interactive mode.

Interact with the Compose Preview to validate behavior

Interact with the Compose Preview to validate behavior


  • Animated Vector Drawables Preview: The Preview window is now also available when viewing vector drawables. When viewing a static drawable, you can use the preview window to change background options between “None”, “White”, “Black”, “Checkedered”, to view your drawable against different conditions. Animated drawables also provide the option to preview the animation at different speeds as well as backgrounds, to help you test animations before using them in your app. To learn more, see Animated Vector Drawables (AVD) preview.

Preview your animated vector drawables

Preview your animated vector drawables


  • Updated Device picker for design tools: To simplify designing your app for the diverse number of Android devices, we’ve updated the device picker in various design tool windows, such as Layout Editor and Layout Validation, with reference devices that reflect popular sizes of each device form factor. From phones to tablets, and Wear devices to Android TVs, it’s now easier to preview, validate, or edit your layout on screen sizes that are most representative of popular real-world devices. To learn more, see Change the preview appearance.

ALT TEXT GOES HERE

To recap, Android Studio Bumblebee (2021.1.1) includes these new enhancements & features:

Build and Deploy
  • Run Instrumented Tests in Android Studio using Gradle
  • Android Gradle Plugin Upgrade Assistant now updates API usage
  • Non-Transitive R classes on for new projects
  • New Device Manager
  • ADB over Wi-Fi
  • Emulator tool window enabled by default
  • Apple Silicon Support Update
Profile and Inspect
  • Jank detection track in Profilers
  • Profileable app profiling support in Studio Profilers
  • Inspect Jobs, Alarms, and Wakelocks in the Background task Inspector
  • Capture Layout Inspector snapshots
  • Support for Compose semantics in the Layout Inspector
Design
  • Interactive Preview
  • Animated Vector Drawables Preview
  • Updated Device picker for design tools

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!

Students Learn Android App Development with Google Developer Student Clubs

Posted by Erica Hanson, Global Program Manager, Google Developer Student Clubs

Google Developer Student Clubs, a program of university based community groups for students interested in Google developer technologies, recently started hosting study groups called Android Study Jams. The goal? Learn Android app development through hands-on codelabs in an online curriculum provided by Google. There are two tracks: one for students who are new to programming, and one for those who already have experience. Interested in participating? Facilitator materials are available for anyone to host Android Study Jams in their community - take a look and get to building.

Google Developer Student Clubs are dedicated to helping students learn programming together, among peers, in a fun and interactive setting. While over 50 thousand students from all over the world have participated in these Android workshops, we wanted to highlight the exciting work from groups in Indonesia, Turkey, and Nigeria. From programming in Kotlin to building a series of apps, these students have put their minds to work.

Learn more about what these three clubs have been up to below.

Indonesia

(Image from UNPNVJ’s Android Study Jams where students are learning Kotlin)

Club members from Universitas Pembangunan Nasional Veteran Jakarta in Indonesia recently came together to host a virtual Android Study Jams session with over 60 students to learn the basics of building Android apps. Their student-run learning session covered several topics, including:

  • An introduction to developing for Android
  • An introduction to coding in the Kotlin programming language
  • A tutorial on setting up and working in Android Studio

After the students felt comfortable with the basics of Kotlin and Android Studio, they combined their new skills to create their own layouts for a birthday card app.

(Image of Birthday cake app)

We can’t wait to see what the students from UPNVJ build next on Android thanks to their new programming skills.

Turkey

(Image from Medipol University where Nelson Glauber is teaching students the basics of Android App Development)

Medipol University in Turkey also hosted their own Android Study Jams by organizing a livestream with over 500 participants. Nelson Glauber, who was the first Google Developer Expert for Android in Latin America, led the event and helped students learn more about topics like:

  • How to display text and images in an app
  • Adding a button to an app and making it interactive
  • Learning more programming concepts in Kotlin like classes, objects, and conditionals

After taking students’ questions, Nelson worked with them to build an interactive dice roller app that updates the screen after the results of a roll.

(Image of Dice Roller app)

Nigeria

The Google Developer Student Club at Kaduna State University in Nigeria tackled different codelabs and learning pathways in their Android Study Jams. In particular, the group worked on the following topics:

  • Adding an additional screen to an app
  • Learning how the Jetpack Navigation Component makes it easier to manage navigation in an app
  • Learning the best practices of app architecture

With these new skills, the group is now able to start working on building more advanced apps that allow users to navigate between multiple screens.

(Gif of Cupcake app)

How to join a Google Developer Student Club and Android Study Jams

If you’re a university student looking to learn more about programming alongside a community of your peers, sign up for a Google Developer Student Club near you here. As a part of the community, you’ll have access to special learning opportunities, including Android Study Jams, on many of Google’s developer products.

If you want to lead your own Android Study Jams or explore other free resources for learning Android development, click here.