Image for post
Image for post
Illustration by Virginia Poltrack

Now in Android #13

Android 11 developer preview, Android Studio 3.6 stable and 4.0 beta, background location guide, easier testing for dynamic feature modules, material motion guide and library, articles, videos, and AndroidX releases

Chet Haase
Mar 3 · 8 min read

Welcome to Now in Android, your ongoing guide to what’s new and notable in the world of Android development.

Hotels and 13th floors. But maybe you like to avoid the number 13 in your life (the 13th floor, the last donut in a baker’s dozen, counting by ones after you reach 12 and before you reach 14). If so, just imagine that this is called #14 instead. And then next time, when I post #14, tell yourself that since it’s about software, it must be an off-by-one error.

In the meantime, there were many things that hit in the last couple of weeks, so let’s get going.

NiA13 in Video and Podcast Form

This Now in Android is also offered in video and podcast form. It’s the same content, but with less reading required. The article version (keep reading!) is still the place to come for links to all of the content that’s covered.

Video

Podcast

Click on the link below, or just subscribe to the podcast in your favorite client app.


Android 11: Developer Preview 1

Image for post
Image for post
The latest Android release turns it up to 11

The big Android developer news for the past couple of weeks is that the first developer preview for Android 11 is now available. You can not only install the system image and play with it on one of your developer devices (Pixel 2, 3, or 4), you can (and should!) also test out your app to see how it looks on the new release (using one of those test devices or the emulator). While you’re there, check out some of the new features and APIs that you might want to use.

Here’s a small sample of the features you’ll see in this first preview:

  • Support for 5G, with new APIs to check unmetered status and bandwidth capabilities
  • Bubbles, a system-wide UI for seeing ongoing conversations. Bubbles were introduced in Android 10, but hidden behind Developer Options; now they are enabled in the platform and the API is available for use.
  • One-time permission: The tri-state location permission introduced in Android 10 (allowing access to location while apps were in the foreground only) was popular with users, so we are expanding that concept to make the permission available only while the app is in the foreground during this session. Also, we’re adding the microphone and camera to the list of permissions with this additional layer of user control.
  • Scoped-storage protections which began in Android 10 are being expanded. Some new capabilities to make access to scoped storage easier include batched edits and access to raw files and paths.
  • BiometricPrompt APIs which handle a wider variety of device capabilities have been introduced in Android 11, and are also available in the biometric AndroidX library for compatibility.
  • Data blobs (which stands for “binary large object”, but I prefer the term “blob”) may now be shared between apps through the BlobStoreManager API. This could be useful for a large download, like an ML model, which an app wants to make available to other, related apps that also need that data.

For more info on Android 11, check out the article on the Android Developers Blog, and head over to the preview site to read about the specific changes and to download the system image.


Android Studio

Our IDE had a couple of important releases recently.

3.6: Stable

The 3.6 release of Android Studio recently went stable. I’ve talked about 3.6 in a previous edition of Now in Android, and maybe you’re already using it. But in case you were waiting for it to be complete before updating, that time is now.

Hop on over to the Studio download page to get your very own copy. Here are some of the things you’ll find in this version:

  • Improved and easier leak detection
  • Split-view for code and design resource file editing
  • View binding (see Sean’s article about this, referenced below)
  • Emulator improvements for working with location and multi-display situations.

4.0: Beta

I’ve also talked about 4.0 recently. But if you were waiting for it to get out of that alpha stage, now’s your chance. Some of the fun features you’ll find in 4.0 Beta include:

  • MotionEditor, the visual editing tool for the new MotionLayout API that enables richer animations
  • Live LayoutInspector

For more about the 4.0 design tool changes in particular, check out Nicolas Roard’s Twitter thread:

4.1: Canary

Just to round out the offerings, you can also live on the wild side and download the newest version of Android Studio, 4.1, which is now available in the canary channel.

The main reason I’m calling it out here is that the Jetpack Compose compiler has been removed from the 4.0 release. So if you want to play with the pre-alpha Compose UI toolkit APIs, you’ll need to use version 4.1.


Background Location Guide

Q: What are the three most important things about user privacy?
A: Location, location, location.

One of the larger areas of privacy changes in recent releases has been around location. It’s critical that applications accessing user location have permission to do so, and that that access is transparent to and controllable by the user. But this behavior can require effort from application developers to get it right.

To help, we’ve created a new guide to help you understand how you might be accessing location while in the background, and to give you tips on how to update your app to provide alternatives to such access.


Dynamic Feature Module Testing

Dynamic feature modules are a powerful way of improving download and install experiences for users, by moving elements of your app that aren’t required on first launch into optional modules that can be installed later.

But testing dynamic feature modules proved difficult, since it required installing the bundle on the Play Store.

Wojtek Kaliciński has been working to make this easier, through enhancements in the Play Core library, along with documentation and samples. Now, you can use version 1.6.5 of the library and test the functionality locally.

Check out Wojtek’s article for the details, along with the new documentation about local testing of module installs.


Material Motion

Image for post
Image for post

Animation is a powerful way to make application UIs easier to understand and to interact with. But… animation can be difficult to implement, especially for rich motion involving transitions between elements and activities.

The Material Design team recently posted a comprehensive guide for handling UI Transitions in your application. Even better: version 1.2.0-alpha05 of the Material Design Components library provides transitions implementing this guidance that are ready for use in your app.

Check out the excellent documentation and the article for more on how to integrate these new transitions into your app.


Articles

Nick Butcher added two new articles to his ongoing Android Styling series, both around theme attributes:

Android Styling: Common Theme Attributes

In this piece, Nick goes over many of the common theme values that you should consider using in your applications, to avoid creating your own or even hard-coding values. These values are handy not just to avoid all of that pesky typing in creating your own resource, but also for creating consistency throughout your application and with the platform overall. For example, there are many standard color theme values (including a standard set in the Material guidelines) that work well together. But also, common textAppearances, shapes (for Material apps), button styles, and more.

Android Styling: Prefer Theme Attributes

In this third article of the Android Styling series, Nick discusses how (and why) to use theme attributes for colors in your app instead of resource references (spoiler alert: they provide flexibility as well as semantic clarification).

Use view binding to replace findViewById

I talked about View binding in a previous Now in Android episode, in the context of Android Studio 3.6. Briefly: View binding is a feature integrated into Android Studio which allows you to easily get a type-safe reference to the views in your layout without using the long and tedious findViewById() call that we all know so well.

But if you were wondering how to use it and how it works, Sean McQuillan dives into it in his article.

Using Biometric Prompt with CryptoObject

Isai Damier’s article shows how cryptography and biometrics work together to secure data, especially for government, finance, healthcare and enterprise apps. These concepts are also shown in Isai’s code sample.


Code Sample: Biometric Login

Speaking of biometrics, Isai Damier created a new sample to help show developers how to use the AndroidX biometric library to correctly integrate biometric authentication into your apps.


Videos

Vector Assets

One of the things the Android Developer Relations team does is give tech talks at conferences, meetups, bus stations… wherever we happen to be when someone hands us a mic and a projector and forgets to turn them off.

Often, these talks are recorded and published for consumption after the fact. But sometimes, it’s worth sharing the content more broadly than it might be shared otherwise. So we are recording some of these talks after the fact to create optimized versions for wider sharing on the Android Developers channel.

The first example of these recorded conference talks is Nick Butcher‘s video on Vector assets, where he shows how to use vectors to provide sharp, resizable, and animatable images.

Nick Butcher gives a conference talk to an empty room and a camera

Sealed Classes

Florina Muntenescu continues her Kotlin explorations with a video about sealed classes

Florina Muntenescu continues her series on Kotlin Vocabulary with this new video on sealed classes. Sealed classes are useful for representing data that can only have limited values, but which needs more flexibility than you get with enums.


AndroidX Releases

A few libraries went stable recently:

These are all primarily bugfix releases, but the Fragment library also added some helpful lint checks.


Now then…

That’s it for this time. Go check out the Android 11 developer preview! Download Android Studio’s 3.6 stable or 4.0 beta release! Check out the new guide on background location! Enable easier testing for your dynamic feature modules! Go see the new Material Motion guide and download the library that makes it all easier. Read the latest technical articles in the Android Developers publication on Medium! Check out the new sample on Biometric Login! Watch a tech talk on vector assets or a video on Kotlin’s sealed classes feature! Get the latest AndroidX libraries stable releases! And come back here soon for the next update from the Android developer universe.

Android Developers

The official Android Developers publication on Medium

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store