Now in Android #37
Android 12, MAD Skills WorkManager, AndroidX, Articles, Training, and an ADB podcast episode
Welcome to Now in Android, your ongoing guide to what’s new and notable in the world of Android development.
NiA37 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 12: Developer Preview 2
The second developer preview release for Android 12 is now available.
Read the blog for an overview of what’s in the release for developers, from picture-in-picture improvements, to a new RenderEffect API for easy and powerful graphical effects like blurs and color filters.
Meanwhile, we’ve improved the developer documentation for these preview releases, in a couple of ways:
- Summary: To help identify the most relevant features and changes for your app, we added a summary table. You can filter based on category, such as Media or Privacy, as well as whether the change affects all apps or only those with certain target API levels.
- Foreground services: Foreground service launch restriction is one of the behavior changes in Android 12. With a few exceptions, it affects apps (target API level >= S) that start foreground services from the background. In response to your feedback, we added additional clarifications and guidance on details, such as battery optimizations and exceptional cases.
Check out the Android 12 Preview site for information about behavior changes, new features and APIs, and more. And most importantly: try out your app on the new release and send us feedback with any issues you have; that’s the whole point of releasing these previews early, so that we can polish things up by the time we ship the finished product.
Stay tuned for more releases as we continue driving toward the final release, with increasing amounts of features, fixes, and functionality. For sure.
MAD Skills: WorkManager
The MAD Skills series continues to roll on, with technical content about modern Android development. The WorkManager series in MAD Skills is coming to an end this week, but first there’s more content to check out:
Deprecation of Firebase JobDispatcher and GCMNetworkManager:
Are you still the Firebase
GCMNetworkManager APIs? If so, then you should… not, because both of these are deprecated, and it’s time to move on. WorkManager to the rescue!
In this episode, Caren Chang shows how to migrate your code to use WorkManager. In addition to the video below, be sure to check out the guides on migrating from Firebase JobDispatcher and GCMNetworkManager.
Hugo Visser shares how he uses WorkManager to schedule regular data downloading and processing in the health app that he works on. He also shares how an issue that they found on some devices resulted in their filing a bug that is now fixed in the latest releases of WorkManager (feedback helps!)
For the final episode in the WorkManager series, we will once again have a livestream Q&A with WorkManager experts. Join me (asking the questions), along with Ben Weiss & Caren Chang (your hosts for this series) and Sumir Kataria & Rahul Ravikumar (the engineers behind WorkManager), on Thursday morning (Pacific time) as we try to answer all of your questions about this API.
I know there’s a good chance you’re reading this after the Q&A already happened. Don’t worry: you can still check out the recording at the link below to see what happened.
But Wait, There’s More!
There were also a couple of interesting new libraries that just hit their first alpha release, including:
- SlidingPaneLayout 1.2.0-alpha01: This version offers foldable device support, and automatically adjusts the sizes of the two panes so that they are on either side of a device’s fold. New documentation on Creating a two pane layout was also released, walking through the steps needed to integrate
SlidingPaneLayoutinto your app.
- The App Startup library is now used by WorkManager 2.6.0 and Lifecycle 2.4.0. I discussed the App Startup library in a couple of articles (Part 1, Part 2) back in December. The advantage of using App Startup, rather than the classic
ContentProviderapproach for pre-loading libraries, is that libraries can be loaded lazily, incurring the cost of initialization only when necessary instead of every time the app starts. Also, App Startup allows you to use just one
ContentProvider(to load App Startup itself) to load multiple libraries, skipping the overhead of having separate providers for each individual library.
- Lifecycle 2.4.0-alpha01: Speaking of Lifecycle, this version adds new APIs to the lifecycle-runtime-ktx artifact for collecting a Kotlin coroutines flow from your UI. Manuel Vivo goes into the details on a safer way to collect flows in his new blog post.
Oboe is a native library for achieving high-performance, low-latency audio across Android releases and devices. We talked with the Oboe engineers last April on the ADB podcast, and now Oboe has been integrated into the Games SDK. Daniel Galpin posted an article on the Android Developers blog detailing how to add it to your project and start using it in your code.
High Performance Game Audio with Oboe
We've added the Oboe C++ audio library to the Android Game SDK. Oboe's support of high-performance, low-latency audio…
Get with the Flow
A safer way to collect flows from Android UIs
Learn how the addRepeatingJob API protects you from wasting resources and why it’s a good default for flow collection…
All About Pending Intents
Nicole Borrelli posted an article on how and when to properly use
PendingIntents. This topic is timely, with the security-driven change in the next release requiring that apps targeting Android 12 declare the mutability of
Android Basics in Kotlin, a course for people that want to learn Android development fundamentals while also learning Kotlin programming, just released Unit 4: Connect to the Internet. This new content will have you coding with Kotlin coroutines and learning how to use important libraries like Retrofit and Coil for dealing with network data.
Android Developers Backstage now has a new site, a new feed, and a fancy new logo!
This change shouldn’t affect current ADB subscribers; the feed redirects so you do not have to re-subscribe. But if you’re looking for show notes for future episodes, check them out on Libsyn at adbackstage.libsyn.com.
ADB 159: Interview with Chris Lacy
The first episode posted to the new site and feed was our interview with Chris Lacy, a long-time independent Android app developer. Romain and I talked to Chris about how he implemented some of his apps, and some of the things he learned about Android programming and APIs along the way.
That’s it for this time. So go read about the latest features in Android 12 DP2! Watch the latest episodes in the WorkManager MADSkills series! Play with the latest AndroidX library releases! Read articles on Oboe, Kotlin flows, and Pending Intents! Take the latest unit in the Android Basics in Kotlin course! Listen to the latest ADB podcast And come back here soon for the next update from the Android developer universe.