[MUSIC PLAYING]
CHET HAASE: Welcome to "Now in Android" episode number 31.
First off, let's talk about Modern Android Development.
There were a few things going on with the "MAD Skills" series.
First of all, maybe it's time to get your MAD Score.
Have you ever wondered how MAD you are, or more
importantly, how modern your app is?
We've provided a new plugin for Android Studio, which you can
find in the Plugin Marketplace.
Install and run that plugin, and then it'll
give you a MAD Scorecard that you can then share on Twitter.
Just something fun to do to figure out
how much of these four pillars of modern Android
you are using in your app, and let us
all know about it as well as the "MAD Skills"
series, which is rolling on with more and more content.
So we finished up the Material Design Components,
the MDC series with a couple of episodes.
There was a "Material Motion" episode
from Nick Rout talking about the four patterns of motion
in Material.
And he walked through the Reply sample app
to show you how that stuff works as well as a Codelab that
is based on that app.
And then we had a community tip from Zarah Dominguez,
where she showed how her team at her company
uses the Material Design catalog app, both to see how things
actually work and look in practice,
and then to take a look at the source code of that app to see
how to implement these things.
Also, we ended up with a live Q&A.
And this had people from both developer relations
as well as the engineering team, experts in MDC.
We got questions from Twitter.
We got questions from YouTube.
We got questions from the universe in this live Q&A chat
that we had on YouTube.
So hopefully, you got your question in.
And hopefully, you got your answer back out the other side.
Then we continued on with a wrap-up of that series.
So check out Nick Rout's article if you want links
to all of the content that we created as part of that series
as well as the articles that talk about this stuff as well.
And then next week, which is this week,
we started the next series, which is on Kotlin and Jetpack.
There are two episodes on that so far.
The first is from Florina Muntenescu on using KTX.
So this gives an overview of the Kotlin Extensions
Library that we provide, and shows
how we use KTX both for platform as well as APIs
in the unbundled libraries.
And Florina shows how she uses it,
for example, when she uses LiveData and ViewModel.
We also have a second episode, from Manuel Vivo,
on simplifying APIs with coroutines.
And this talks about how to take existing APIs and libraries
and create adaptor APIs using Kotlin coroutine
flow to simplify some of the complexities
for Kotlin developers such as the intensity, the difficulty
we have with nested callbacks in some
of these solutions for asynchronous behavior
in these libraries.
And you can vastly simplify that by using coroutines in Kotlin.
There is going to be more content in that series
as we go on.
That series will continue in January
after a bit of a holiday break here.
So go check out the "MAD Skills" series
on YouTube, the articles, and continue
checking out that content as we continue producing it.
There were a couple of important fixes for the documentation
of Android.
First of all, in permissions.
So the last few releases, it's probably obvious
we've been making a lot of changes in the platform
to make it a little more obvious to users
how their user data is being used and giving
them more transparency and control over
the use of that data.
But that means that app developers
need to figure out how to respond to these behavior
changes.
So we've clarified the documentation
to make it a little bit easier to understand
what is going on there.
We're continuing to work on it.
But in the meantime, there were important changes
to the "Permissions on Android" guide.
We talk a little bit more about how
permissions work in general.
We have some best practices there
and give information about how to use
these permissions in your app.
Also, it's worth asking yourself the question of whether you
actually need permissions.
It's common practice for applications
to ask for permissions for some things
where maybe you don't need that.
If you're asking for an external app to take that picture,
you don't need the camera permission.
That app is taking care of that side of the house for you.
Also, on the Room side, we enhanced the documentation
that we provide for the Room local persistance library.
So we have one section on using Data Access Object
or DAOs with Room that gives an overview of how these works,
talking about using the built-in query
methods that are easy just to plug in and use directly,
as well as custom methods that you can create
using the @Query annotation.
There's also another guide talking about writing
asynchronous DAO queries.
Talks more about doing these queries--
in particular, about doing this in an inherently asynchronous
world.
In AndroidX, of course, there were releases.
There are releases every two weeks.
The releases in particular that I wanted to call out
were a couple of stable releases.
You might want to check out Browser 1.3.0.
This one has the ability to pass freeform commands
with the Trusted Web Activity APIs
as well as various other features including
setting colors on custom tabs.
Media2 1.1.0 came out.
This has a whole bunch of bug fixes
along with handling media tracks and interop with the AndroidX
Media library.
Makes sense-- Media2, Media library.
I think they get together just fine.
Also, WearInput 1.0.0, this is the first version of WearInput,
and this provides support for wearable buttons
now in the AndroidX library.
There were also a bunch of other releases in there
including some stable releases of bug fixes for ExifInterface,
Media, and Navigation.
In Android Studio, there were a couple
of articles posted talking about new versions.
So Jamal Eason published an article
talking about the next release of Android Studio, that is
now in Canary named Arctic Fox.
So the first thing you may notice about that is the name.
Normally, we refer to Android Studio with really interesting
names like 4.1 and 4.2.
And now, we are using actual animal names
to refer to them, Arctic Fox being the first one.
So it talks about that naming thing there.
Also, we talk about it in a podcast
that I hope to publish this week.
Had a chat with Tor and Romain, sort of a wrap-up of the year,
and we talk about the naming change for Android Studio
as part of that.
Jamal also talks about some of the features
in that Canary release including a UI--
specifically on macOS for now, coming to other platforms
later--
for pairing with a device over the new feature
that we had in the latest Android
release for doing Wi-Fi debugging with devices.
There's a layout validation tool,
and there's also continued support for Jetpack Compose.
I should point out, if it's not obvious,
if you are doing Jetpack Compose development, that is always
done in the Canary release of the tool,
because that is very much pre-release.
So continue to use the Canary for your continued efforts
in Jetpack Compose development.
Also, Murat Yener posted an article about an Android Studio
Gradle release.
He talks about the latest changes in 4.2.
But he also talks about the next version, which is also
going through a naming change.
We are now going to sync to the actual Gradle versions instead
of the Studio versions, which explains
why we're going to jump from version 4.2 up to 7.0.
No, we didn't make that many changes.
We're just aligning with something
that makes a little bit more sense
for the underlying technology that we're using there.
There were a bunch of articles that were posted
that are worth checking out.
First of all, ListAdapter.
Meghan Mehta has been posting a series on RecyclerView.
Now, RecyclerView has been out for a while.
I expect most Android developers are already
using it for that feed of data that you have.
It's a pretty common element to have in there.
But if you're new to RecyclerView,
if you're trying to figure out what's going on there,
it became clear to us that we don't
provide some of the basic, fundamental information.
I just want a simpler RecyclerView
to do some tech stuff.
I just want to understand how it works.
And so we took a run at simplifying the documentation,
adding more samples in there, as well as this series of articles
that Meghan's been doing.
So the latest one in that is the second article
that she's published, which is on ListAdapter, which
you can use as an easier way to get an adapter that actually
provides more information to RecyclerView, which allows you
to have better performance, because it doesn't have
to redraw everything, as well as automatic item animations.
If you're just using a custom adapter,
and you don't plug into DiffUtil by default, which ListAdapter
does, then you're not going to get that functionality.
So you definitely want to look into using
ListAdapter in general for your RecyclerView needs.
In performance, I've been looking into startup
performance recently.
I started with how to test startup performance
a few weeks ago.
And then I now have a two-part series
where I look into the App Startup library, which
reached 1.0 recently.
Part 1 looks into content providers,
and how they are generally used to initialize libraries,
and how they generally do it in kind of a hidden way--
like they just sneak into your merge
manifest, and maybe you didn't know they were there.
So we look into how that works and how that could be affecting
your startup performance as this stuff gets
automatically initialized and loaded, unbeknownst to you.
And then part 2 looks into using the App Startup
library potentially to pull several requests
and pull those content providers out of the merge manifest
and allow App Startup to lazily initialize
the libraries as that makes sense
for you and your application.
Also, there was a really interesting article
posted about GPS location on the "Android Developers Blog."
Now, most of the article is about the user feature
of basically getting better location information in cities.
The problem, which is apparently called urban canyons--
we talked about it in a very old "Android Developers Backstage"
podcast episode years ago.
In 2014, we talked with Marc Stogaitis,
who was the TL for location.
Urban canyons is the issue where, when you're in a city,
GPS really likes line-of-sight to figure out your location.
So you're walking down the street,
and you can't see the satellite.
But rather, you get to that satellite
by bouncing off a building.
And then the software has a hard time--
well, the sensor has a hard time figuring out
where you are because the signal is being bounced around
all these tall buildings in these canyons
that these cities have.
So they figured out, using interesting technology
of 3D models that are provided for many
of the major cities in the world,
how we can actually track better location information
through a combination of that geometry as well as the GPS
signal.
Totally interesting in a very geeky way.
But also, there is a developer surface area there
that they talk briefly about.
One is that if you are not using Fused Location
Provider to get your location, you probably want to.
That is how you're going to access that enhanced location
information on the platform.
Also, there is a new API in Fused Location Provider called
getCurrentLocation().
This is a much easier and more straightforward
way to get your current location.
Previously, you had to register for a callback
and then wait for it to call back.
And then you would take that first callback
and then unregister it.
And it was just sort of this convoluted
way of getting the thing that was really pretty simple
that you were asking for.
So getCurrentLocation() is the API to use,
and there's a link there in the article so you can get more
information on that.
Also, there's a new sample called CurrentLocationKotlin.
So you can check that out to see how to use this in practice.
Chris Banes has this sample app that he's
been working on called Tivi.
And he has been going through an effort
to migrate that to use Jetpack Compose.
So he's completed a major step of that,
so that now all of the UI for Tivi is written in Compose.
So he did an analysis of what were the changes
and what did he observe in doing that,
in making it all work in Compose,
in three areas in particular.
He looked at APK size, which is smaller
in the new version, which is great--
much smaller, method count, which
is somewhat smaller in the new version, which
is also good, and build duration,
which is a little bit smaller.
So all of that is moving in the right direction,
and you can check out the article
for more information on that.
And he will continue that migration,
so I'm sure there's going to be more on that in the future
as well.
CameraController is a new API in CameraX.
CameraX is still in beta.
So the original CameraX API had this thing called CameraView.
It combined the logic of both the controller
as well as the UI, and that's really too much for one thing
to control.
You really want a separation of concerns
and encapsulate all this logic in different places.
So it's been refactored into the PreviewView
and this new API that just came out called CameraController.
So the article goes over how to use the CameraController class
and how things compare, how you used to do it in CameraView,
and how you now do it in CameraController.
Finally, there was one more podcast episode
that we had on "ADB."
Romain and Tor and I talked with Jesse Wilson,
who works at Square.
Jesse is famous for working on very
popular open-source libraries out there, including
OkHttp, Okio, and Moshi.
We talked about those libraries in particular,
about libraries in general, about framework development,
about that gene that we have that
makes us see a problem here and then create a library,
an open-source library solution for that one little problem
that you saw over there.
So very interesting conversation with Jesse.
I hope you check that out.
I hope you check out everything else.
As usual, all the links to all of this stuff
are in the article that is associated with "Now
in Android" number 31.
And if you liked the video, go ahead and like and share,
and subscribe to the Android Developers channel on YouTube.
Thanks.
[MUSIC PLAYING]