[MUSIC PLAYING]
ARTUR TSURKAN: Cool.
Hey, everyone.
My name's Artur.
I'm a product manager on Android.
And I'm here to tell you about a bunch of features
that you can take advantage of to make sharing
to and from apps way better.
So as a quick refresher, in Android 10,
we did a pretty big overhaul of the Android Sharesheet.
This is the new UI.
The main thing is that when a user shares for the first time,
they get a much more simplified menu of options that tells them
what they're sharing, who they can share to,
and what apps they can share with.
If the top four apps that were suggest
them aren't the ones that they're looking for,
they can simply scroll up and find
the alphabetically-sorted list.
And we're seeing some pretty awesome results
from this new sharesheet.
One of the things that we looked at was performance and jank.
And we're noticing that users are loading
the sharesheet a lot faster.
So at 30 milliseconds, about half of Android 10 users
already see the Share UI, whereas 10% of users
would see that on P. And then at about 100 milliseconds,
everyone sees the Share UI, whereas users
on the previous version are still loading.
So there's a lot of really awesome incentive for apps
to adopt the sharesheet.
And I'd love to talk you through a couple of features
to make sharesheet better.
All of this is available on developer docs.
We just overhauled documentation to make
it a lot easier for you to use and for all this information
to be available.
So highly encourage you to check that out.
Couple of things I want to run you through.
So the first is people shortcuts.
People shortcuts are this pane that's
visible above the sharesheet UI.
And the main thing is it's a new API for you
to let other apps share within your app's contacts.
We're prioritizing this new API over the previous API
of ChooserTargets.
And there's a couple of things that we're strongly
encouraging developers to do in order
to implement this really well and to rank in these positions.
Namely, there's a couple of fields
that we want you to implement.
The first is to setLongLived to be
true to provide us a rank so that we can know relatively
if you give us more than one person, which one should go
first, and then also to actually define
the details of the person that you're sharing with.
Just so that we have a semantic understanding that, hey,
this is a person-related shortcut.
And then these person shortcut informations
can actually be exposed in other parts of the OS.
And that provides us a really good signal
that, hey, this person's, like, important,
and maybe someone that you want to share to.
So you can actually embed this information into notifications,
for example, using the Builder method.
So to walk you through a couple of code examples,
this is an example of how to produce a sharing shortcut.
So first step that you want to do
is actually define the person.
The one thing I want to point out here is at minimum,
we just ask that you provide private data that's
stored on the operating system and not shared
with any other app.
You can also optionally integrate it
into the context provider API for total ranking advantage.
That's not required.
And then you build your shortcut.
So you set a ShortLabel, Long Label, Person and then
the LongLived in rank fields that I talked about, and then
just build that.
And then the operating system will rank
the shortcut as appropriate.
And then this is an example of how you link
using the same [? UU ?] ID--
that shortcut in your notifications.
And so when you send notifications
that are related to that person, that's the way
we'll know that it's relevant.
Another tip that I want to talk to you
about is handling images and files.
So when you set a MIME type, we use
that to set an appropriate content preview for the user
to know what they're sharing.
And that's also a way that we surface
the right targets for the user.
And so there's a couple of important do's and don'ts that
we want to encourage app developers to do so that we
provide the right targets to users.
The first is avoid super broad MIME types.
Just make sure that whatever you're providing
can handle the payload that it's going to accept.
One common case that we see is developers set text/plain
when they're actually only trying to accept addresses.
If you're willing to accept text/plain,
just make sure that that is the payload that you can accept.
And then the last thing is if you're
sharing multiple files, like multiple images
or multiple documents, just make sure you don't mix types--
keep it to just only images or only files.
And so in this code example, the app
is trying to share multiple images,
let's say a photo album, to another app.
And you can see that they set up their images.
But they only set the single MIME type of image/*.
Cool.
Last tip that I want embark with you
is how to instrument your sharing UI.
You can actually track metrics of when you just
complete a share.
And this is a way you can know not only if the user has
completed a share using your app,
but also what app they share to.
The way that this works is you add a BroadcastReceiver
with a PendingIntent, which you supply when invoking a share.
And then you'll get a callback, which
you can use to understand the results of that share.
So let me walk you through the code example here.
You can see the first half.
These are with developer setting up the share.
And then the second half is them handling the callback
so they can track the metrics.
Cool.
That's all I got.
Thanks so much.
[APPLAUSE]