[MUSIC PLAYING]
MARCO CAVALLI: Hello, everyone, and welcome
to Google I/O. I'm Marco Cavalli, a product manager
on the Google Home team.
And with Pierre Delisle from our partner engineering team,
today, we'll walk you through the features
that Google provides to make it easy
for you to build mobile applications
for the smart home.
Connectivity is a core component of your smart home hub
experience, but it's not differentiating.
And yet, today, app makers spend a lot
of time solving connectivity challenges, particularly
across multiple mobile hardware platforms.
Our new tools for mobile developers
help alleviate the chore of dealing with connectivity
so you can focus on creative, innovative experiences
in your app for your users.
This is an exciting time for the smart home industry.
Adoption has been accelerating, with over 60% of households
projected to own smart devices by 2026.
Over 250 million devices across hundreds of device
types and brands are integrated with Google Home today.
The introduction of Matter represents a pivotal moment
in the industry, with easy setup,
interoperability, and standardization
that promises to further propel smart home adoption.
All the announcements at CES this past January
are just an indication of the industry excitement
around Matter.
Google is uniquely positioned to help
you build the best mobile applications
for the smart home, enabling you to be
more productive and innovative.
On the technology front, Google is fully committed
to Matter and Thread.
Google is an active member of the Connectivity Standards
Alliance and Trade Group, driving both Matter and Thread
initiatives alongside many partners in the industry.
We are upgrading many of our Nest devices
to act as Matter controllers for Google Home and Thread Border
Routers so that your devices and applications can integrate
and take advantage of seamless setup and the interoperability
that Matter provides.
Google Home enables your users to interact with your devices
in the way that is most convenient to them,
from voice to touch screen, and of course, on mobile
via your applications, the Google Home app, and Android
smart home controls.
Android is a significant opportunity for you
to reach the over 3 billion active Android users globally
with your smart home experience.
And finally, Google Home ecosystem
includes thousands of brands, a wide variety of device types,
and over 80,000 of your devices to form
the foundation of a truly vibrant and helpful smart home.
We understand that your apps are important to grow your user
engagement and provide innovative and delightful
experiences to your users.
Today, we are announcing a set of solutions
to help you build high-quality mobile apps for the smart home
quickly, allowing you to focus on your unique value
proposition rather than spending resources
to solve low-level connectivity challenges.
It all starts with a Google Home Developer Center,
our portal for all smart home developers
to learn about Google Home and Matter,
to find resources such as our Sample Application Formatter,
and our APIs, so you can hit the ground running with Google.
Next, Google Play services Matter APIs
make it easy for you to commission your Matter devices
into the Google ecosystem, making them accessible
through the Android smart home controls, or voice, Google Home
app and Nest devices without any additional effort on your part.
Our APIs also make it easy to share your devices
with other apps and platforms, or to connect new devices
to yours, delivering a more seamless, flexible, and
consistent smart home experience for your users.
The Google Play services Matter APIs
are available to our early access partners
today and will be available in developer preview in June
for everyone to try.
Finally, we provide a set of tools
to help you build, debug, and test your smart home
applications directly in Android studio.
The Developer Center is available today
for you to learn about Matter and how
to integrate with Google Home.
You can find documentation on our Google Play services Matter
APIs and our Google Home Sample Application for Matter that
provides a real-life example of how
you can use these APIs in your own application.
The code of the Sample App is available for you to download,
so you can start developing in no time.
If you are building a Matter up, chances are,
you are also building or updating a Matter device.
In June, we will also launch the Developer Console,
which provides a guided flow for you
to start building your Matter devices
and integrating with Google quickly and reliably.
To learn more about the Developer Console,
check out the session Building, Testing, and Deploying Smart
Home Devices for Google Home, and of course,
head over to the Developer Center.
On the Developer Center, you'll also find Google Home plug-ins
for Android Studio.
They provide you with the tools to test your application
and your Google Home integration directly from your development
environment.
The Android Studio plug-ins allow you
to type commands for Google Assistant directly
in the editor, so you can test how
your applications and your devices
interact with Google Home.
And you can review Cloud logs in real time,
again, from inside the ID to debug your integration more
efficiently.
And now, I'll hand it over to Pierre,
who will walk you through how to build mobile applications
for Matter using our APIs.
PIERRE DELISLE: Thanks, Marco.
Whether you are a pro developer and your company wants
to build a smart home application for its own device
ecosystem, or you are a hobbyist Android developer that's
excited and curious about Matter, we've got you covered.
To help you get started quickly, let's
have a look at the Google Home Sample Application for Matter
and how you can use it as a reference
to build your own smart home application.
The Matter Sample Application provides a concrete example
of how to use our new Google Play services APIs for Matter
that make it easy for you to commission
and share your Matter devices across apps and ecosystem.
When you launch the Google Home Sample App for Matter,
the home screen shows the various devices
that are part of the Sample Application fabric.
Since we're just starting, no devices are shown yet.
Our first action is to click the Add Device
button to add a new device to the Google fabric.
Let's say that this device is a Matter-enabled light
that we've just purchased.
But what exactly is a fabric?
A fabric is a core Matter concept
and represents a shared domain of trust among devices
in the home network that enables them
to communicate with each other.
This shared domain of trust is established via a common set
of cryptographic keys.
So let's go ahead and use our Sample Smart Home Application
to add the light device to the fabric.
In the context of Matter, the process
of adding a device to a smart home fabric
is usually referred to as commissioning a device.
To support the commissioning of devices,
Google Play services provides the following key artifacts.
First, there is the Matter class,
which is the entry point for the Matter APIs.
And from that Matter entry point,
we can get a commissioning client.
Two methods are available so that an instance
of CommissioningClient can be obtained either
via a context or an activity.
And finally, we invoke commissionDevice
on that CommissioningClient with an appropriate
CommissioningRequest parameter.
Now let's see what happens in the application when
it causes commissionDevice.
On the returned IntentSender, the app
calls startIntentSenderForResult,
and control is transferred to Google Play services, which
goes through the following commissioning steps.
First, the user needs to establish proof of possession.
This is done via a QR code or a manual set up code.
Then, the device is commissioned into the Google fabric.
To get the device into the Google fabric,
the user has to select the appropriate Google
account and the home where this device will be added to.
And finally, the device is connected to the network,
and it is ready to be used.
Note that all of that commissioning
work and the associated screens are completely
handled by Google Play services when
commissioning devices to the Google fabric
to provide this consistent user experience
and remove the need to handle sensitive permissions
like Wi-Fi and Thread credentials.
To recap, let's look at what has happened so far
through this sequence diagram.
The app caused the commissionDevice API.
This call transfers control to Google Play services,
which does the following.
It asks the user to establish proof of possession,
communicates with the device to commission it into the Google
fabric, and finally connects the device
to the network, which is Wi-Fi or Thread.
Note that the user doesn't need to enter Wi-Fi credentials,
as these are handled behind the scenes by Google Play services.
Now, at this point, the commissioning
that has happened so far has handed the device
to the Google fabric, which enables you or users to control
your device through the Google Home app on Android and iOS,
Android power controls, or voice with a Nest display, speaker,
or Nest Wi-Fi in the home.
That's definitely very convenient.
But what does that mean for your application?
If your application wants to be able to control and manage
that newly-added device independently,
it needs to add it to its own fabric, where
it has the operational credentials
to perform such actions.
Let's use our Sample App to see how
we can commission the device into our own fabric
so that the device can also be controlled
within the same application.
To enable this, we specify in the commission request
the service that will handle commissioning to our fabric.
In this case, the CommissioningService
is implemented by the Sample Apps class
AppCommissioningService.
AppCommissioningService is an Android service
that implements the commissioning service callback
interface.
And the important method in that callback interface
is onCommissioningRequested.
The argument to onCommissioningRequested
is a commissioning request metadata object,
which includes a device descriptor with vendor ID,
product ID, device type, as well as a network location
object with IP address and port number,
allowing for IP-based, multi-admin commissioning.
And there we have it.
As we've discussed, in the first part of commissioning,
the device was commissioned to the Google fabric.
And in the second part, the device
was commissioned on the app's own custom fabric.
Going back to the home screen of the Sample Application,
we see that the device now appears
because it has been commissioned to the app's own custom fabric.
If you do a long press on the device icon,
this brings up the device's specific screen,
where all the various controls supported by the device
are shown.
Now, note that the screen also has a button
labeled Shared Device.
This brings up our next topic, another key feature
of the Matter standard, device sharing.
Sharing a device is referred to as multi-admin flow
in the Matter specification.
We saw in our discussion of the commissioning flow
that the mobile SDK makes it possible to commission
the device both on the Google fabric
and on the app's custom fabric, as shown on this slide.
That's multi-admin right there, where
we make it possible for a device to be
part of more than one fabric.
Now, we may want to share the device with even more fabrics,
especially if this is a household where people have
their own preferences when it comes
to applications and platforms.
Sharing a device on additional fabric
is what's triggered when the Shared Device
button is pressed.
And here's how the device sharing flow works.
The first step is to open a temporary commissioning window
with the device.
Doing this puts the device in the state
where it allows its commissioning
on an additional fabric.
Setting up that temporary commissioning window
is done via the Matter SDK, as shown on the slide.
Information specified in the call to openPairingWith window
includes the duration of the temporary commissioning window,
a discriminator-- which is a random value to discriminate
between multiple devices that may otherwise look the same--
and finally, the setup pin code, also known as passcode.
At that point, the temporary commissioning window
is open on the device.
And the Sample App then uses the Google Play services device
sharing API to trigger the rest of the device sharing flow.
First, we build a shareDeviceRequest.
The device descriptor provides specific information
about the device, such as its vendor ID, product ID,
and device type.
The value set for the commissioning window
are the same as the ones that were
used to open the temporary commissioning
window with the device, as we saw on the previous slide.
Then we use commissioningClient to call the shareDevice API.
On success, we call launch on the shareDeviceLauncher,
which is an activity result launcher that takes over
once the activity that was triggered for device sharing
completes its task.
The device sharing flow triggers the following in the app.
A Share sheet is presented on the screen, which
allows users to choose the application or platform they
want to pair the device to.
The Share sheet provides two ways
for users to share the device, either manually through a setup
code to be shared with the target commissioner app,
or via a local Android application that has registered
as a Matter Commissioner.
And I'll explain in more detail shortly how this is done.
And from then on, it is the target commissioner
that completes the commissioning of the device
into its own fabric so that we eventually
end up in the following state.
The device can now participate in three fabrics, the Google
fabric, the Sample App fabric, and finally, the third fabric
that we have just shared the device with.
Now let's have a look at what a smart home application must
do to be considered a target commissioner when another app
or ecosystem triggers device sharing.
For this, the application must register as a Commissioner.
This is done by specifying an intent filter in the app
for Action_Commission_Device.
By doing this, when a sharing action is initiated,
the app is included in the list.
Google Play services sends the Action_Commission_Device intent
to the chosen Commissioner, including
a set of intent extras, providing information
on the device to share.
The Commissioner receiving the intent
uses this information to construct a new commissioning
request to include in the call to the commissionDevice API.
And with that, we have the whole picture
for sharing Matter devices on Android,
as shown on this sequence diagram.
This concludes our journey of the Google Home Sample
Application for Matter and how to use our Matter
APIs to commission and share devices
with Google and other applications and platforms.
The Matter APIs are available to our early access partners
in the Google Play services today
and will launch as public developer preview in June.
To familiarize yourself with the Matter APIs,
head over to the Google Home Developer Center,
where you can find our Sample Application, code labs,
and more details.
Have a pleasant journey.
[MUSIC PLAYING]