Hi everybody.
I really hope you’re enjoying your time with us today at Google I/O.
My name is Nicole, and I’m an Android engineering lead at Google.
I’m here today with Diana, a product manager, and David, a partner manager.
We’re excited to share core improvements we’re making in Android 12 to make it easier
for you to build useful and beautiful widgets that users can easily discover
in Android and Assistant.
We’ll also give a brief demo throughout
of how you can utilize all of these changes for your own widgets.
But first, to set the stage, Diana is going to take us back to the beginning.
Thank you, Nicole.
Now, let's go back to 2008, when the first Twilight movie came out,
Flo Rida’s “Low” tops the Billboard charts,
and we still took selfies in the mirror with an actual camera.
That’s also when widgets made their first appearance in Android Cupcake.
A supplement to the app rather than a replacement,
widgets were, and still, are a great way for users
to quickly monitor information, complete tasks,
or be inspired by their home screen,
and we know a few reasons why widgets have worked so well for so long.
First, widgets are useful.
They provide easy access to relevant, glanceable information
without needing to launch the app.
From being able to see upcoming appointments,
start playing music, to checking off to-dos,
widgets help people get things done.
This utility is why it's not surprising to see
in one poll of Android users, that 84% said they use at least one widget,
and the majority, 63%, said they used multiple.
Widgets are also personal.
We know users enjoy customizing their phone experience
beyond the wallpaper, across Android and iOS.
One in seven iOS users in the US have at least one widget,
and the most popular of these all focus on customization.
Widgets are the primary way users can make their phone feel uniquely theirs,
which often brings delight to these users.
Finally, widgets are engaging.
They are a great way to inspire users,
especially in apps’ most avid users to interact and re-engage with their apps.
Widgets have also gained popularity over time.
For example, Google Keep's Android widget
sees over three and a half times the engagement today
than it had in 2018, and for Keep and other Google apps,
we found users with widgets generally engage with apps
more than those that don't.
From 2008 to today, widgets have been successful
for users and developers, but as announced in the keynote,
Android 12 is the biggest refresh to the system UI in years,
and widgets should not be an exception.
So we asked ourselves, how might we similarly refresh widgets?
Determined to answer that, we began rethinking the future,
and as a result, we refreshed widgets in Android 12
so that they can help you drive your app engagement
through increased widget adoption.
Meanwhile, we made sure that we also provided the tools
and resources to make these widgets even easier to build and maintain.
Now, let’s dive into the details of what you can look forward to in this release.
To achieve the goals mentioned earlier,
we focused on making it easier to build widgets
that are more useful, discoverable, and beautiful,
three key factors for driving widget adoption and app engagement.
We understand users won’t interact with a widget
if they don't find any value in it.
We’ll start by discussing how it’ll be easier to make widgets that are more useful.
We're adding more native support for interactive elements,
like checkboxes, switches, and radio buttons,
in addition to our continued support
for elements like vertical scrolling and multiple tap targets.
By adding support for these tappable controls,
users can engage with your app just from the home screen.
These elements work perfectly for applications like this list widget.
These snippets show how you can add compound buttons,
like a checkbox to your widget, and listen to state changes.
These compound buttons also provide material complaint animations,
to make your widget look and feel more consistent with the system.
We know users like widgets that are relevant to them,
so we've made it easier to personalize widgets.
While widget reconfiguration was available before,
most launchers didn't easily allow users to edit their widget configuration.
We added an entry point to make this action easier and more discoverable.
Apps can also choose to skip the initial configuration activity,
if they feel confident in their default settings, removing unnecessary friction
for users who want to add your personalizable widget.
As can be seen in this code snippet,
making your widget reconfigurable starts with adding the reconfigurable flag.
You can skip the initial configuration activity
by adding the configuration optional flag as well,
perfect for personalizable widgets that don't need additional setup.
In summary, useful widgets will be easier to build
with our added support for interactivity, and better support for customization.
However, we also understand widgets need to be discoverable
so users can find, add, and use them.
So I’ll pass it off to David to tell you more.
Thanks Diana.
It's exciting to see how flexible widgets have become.
In Android 12, widgets will appear in more places
with better tools to help users find and interact with them.
Often, the first time a user sees your widget is in the picker.
Therefore, we want to make sure get the most accurate sense
of what your widgets look like, and which functions they serve.
What does your widget do?
In Android 12 we’re improving this experience by showing more realistic preview layouts,
and displaying widget descriptions so that users can quickly understand
why your widget is right for them.
What the widget picker currently shows is a drawable resource
which does not accurately reflect the widget’s appearance,
but now, you can add a preview layout attribute
to the app widget provider tag, which provides an XML layout
that can be displayed instead.
Ideally, this should be the same layout as the actual widget using default values.
You can also provide a description to be displayed
with your preview by assigning a string to the description attribute.
Your widget will be appearing in more places in Android 12,
starting with Android’s on-device search, Assistant on Mobile and Auto.
This means that, not only will you benefit from assistance discovery mechanisms,
but users will also be able to easily find
and reference your widgets outside of the home screen.
One example with the new Assistant integration,
is users would be able to complete an order
from start to finish using a widget in Assistant.
Using the new capabilities API, you can enable new discovery mechanisms and contexts,
which are useful when users need hands-free updates
while their phone is locked or when they’re in the car
with Assistant in Android Auto.
For example, Strava can allow users
to quickly check their stats with voice and add the widget
from the Assistant panel to their home screen.
Invoking widgets through voice is similar to how App Actions BIIs
allow users to deep link into apps today.
Simply adding a top-level app-widget tag under capability
will signal that this is a widget fulfillment.
Here, we associate the GET_ITEM_LIST BII with the widget to quickly open it via voice.
Beyond one-shot answers and quick updates,
the integration with Assistant also enables multi-step interactions.
This means users can have a full conversation with Assistant
using the same widget to complete flows that take several steps,
like selecting and ordering a menu item with Dunkin.
Adding text-to-speech to the widget is handled
in the widget provider, with the Widget Helper SDK.
This allows widgets the flexibility to make network calls,
or do other work before sending the text that needs to be spoken by Assistant.
As you can see here, combining views
and text-to-speech responses together allows Dunkin
to have a full voice order experience powered by Assistant.
If users order on the road or in a compatible car,
navigation to the destination is handled seamlessly by Android Auto.
Now that we've seen how widgets together with Assistant
can be more discoverable, I'll pass it off to Nicole
to tell you about how Android 12 will ultimately
make it easier to build more beautiful widgets.
Thanks David.
The last step to drive user delight and engagement
is how your widget looks, which is especially important
given the new visual design in Android 12,
and the system UI refresh, developers can achieve this
through more consistent designs, smoother transitions,
and the use of improved guidance.
Users love having visually appealing home screen.
In Android 12, we are making widgets look and feel
harmonious alongside other widgets and app icons,
by introducing system level resources
which allow the launcher to control padding and corner radii.
Note that if you don't apply the system level resources,
the launcher will automatically apply a mask to the widget,
so the corner radii are minimally consistent.
Going back to our checklist example,
this snippet shows how to add a system level resource for corner radii.
This way, the widget automatically adapts
to look great on every launcher and home screen.
As foldables and large screen devices gain popularity,
it is important to ensure apps and widgets
are designed and built with flexibility in mind.
Responsive layouts allow developers
to provide the best layout for display sizes,
similar to webpage resizing in browsers.
We are also giving developers more control over the size of their widgets,
so they always look great on phones, foldables and tablets.
In this code snippet, you can see how to configure
your widget sizing options by providing default sizes
in terms of the launcher grid, using target cell width and height,
and if your widget is resizable, you can now also constrain
the maximum size of the widget using max resize, width, and height.
Here you can see how to configure your widget
to adapt to different display sizes, which allows you to extend your widgets
to larger form factors, like foldables and tablets.
You can fine-tune your appearance to the exact display size,
or you can provide a series of layouts to use at different sizes.
As announced in the keynote, we are introducing color theming
so Android users and device makers can easily personalize device colors and theme
to ensure widgets look expressive and great on every device.
We've also added dynamic color APIs,
which allow your widget to leverage the system colors,
or for pixels, colors extracted from the wallpaper,
creating a personalized uniform look across the home screen.
Adding dynamic colors is as simple as adding a system theme to your widget,
and using the color attributes defined in the system.
We also announced in the keynote how we are improving transitions in Android 12.
As part of this effort, we are creating smoother transitions
between your widget and app.
All you need to do is add an ID.
Developers can enable these smoother transitions
by annotating the background with the relevant ID.
The launcher then handles the rest.
Ultimately, we want to make sure that developers are well-equipped
to create and design widgets that users enjoy and engage with.
So, in addition to the Material-compliant components added,
we're also creating revamped guidelines
that help make your widget more modern for 2021, not 2008.
With all of these improvements to widgets and the Android visual design,
we're excited to have developers create next generation,
beautiful widgets to be part of the new and improved home screen experience.
Lastly, we will preview how we are making it easier
to build and maintain widgets using Jetpack Compose.
Building widgets should be easy and seamless with the rest of Android UI development,
so later this year, we will be introducing a new Jetpack Compose library.
This resource, along with additional tooling in Android Studio, will make it easier
to build great-looking responsive widgets, that are also backwards compatible.
We’re in the process of designing the library
but here’s a conceptual snippet of how the code for our shopping list widget may look.
Compose makes widget development faster and easier,
since you can define the UI in just one file,
and all of the rest of the widget features are built in.
If you’re interested in this new approach for building modern widgets,
stay tuned for our beta launch.
In summary, there is a lot to look forward to in Android 12.
This is the largest modernization and refresh of widgets
since they were launched in 2008.
We have made these changes to help you, the developers,
increase your widget adoption, drive app engagement,
and build great widgets in less time.
We cannot wait to see what you will come up with using these new APIs.
Thank you for tuning in.
If this session has you excited to refresh your widgets,
you can get started using the documents listed here.
If you’re interested in what our upcoming Compose library has to offer,
then stay tuned for the beta launch later this year.
Thanks again, and enjoy the rest of Google I/O.