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
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.
Click on the link below, or just subscribe to the podcast in your favorite client app.
Android 11: Developer Preview 1
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.
Our IDE had a couple of important releases recently.
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.
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:
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
Local development and testing with FakeSplitInstallManager
New releases of Bundletool and the Play Core library made local iteration faster and testing possible with on-demand…
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.
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.
Nick Butcher added two new articles to his ongoing Android Styling series, both around theme attributes:
Android Styling: Common Theme Attributes
Android Styling: Common Theme Attributes
In the previous article in this series on Android styling, we looked at the difference between themes and styles and…
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
Use view binding to replace findViewById
New in Android Studio and Android Gradle Plugin 3.6, view binding gives you the ability to replace findViewId with…
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.
Using Biometric Prompt with CryptoObject
Using BiometricPrompt with CryptoObject: How and Why
Biometrics and Cryptography are not the same thing. They are in fact completely independent of each other:
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
Sample for the Androidx Biometrics Library Copyright 2020 Google LLC. All rights reserved. Licensed under the Apache…
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.
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.
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.