To help you build Android applications that interact with
Matter devices, Google has developed the
Google Home Mobile SDK. The
Mobile SDK includes two core APIs that allow your apps to
commission and share devices with the Google fabric.

- [Commissioning](https://developers.home.google.com/reference/com/google/android/gms/home/matter/commissioning/package-summary.md.txt)
- [ShareDevice](https://developers.home.google.com/reference/com/google/android/gms/home/matter/commissioning/ShareDeviceRequest.md.txt)

Once a device is added to the Google fabric, your users can control their
devices through the Google Home app (GHA), Android power controls, voice,
and Nest touch screen devices.

The Mobile SDK also allows you to define a
[custom commissioning service](https://developers.home.google.com/reference/com/google/android/gms/home/matter/commissioning/CommissioningService.md.txt)
that you can use to commission devices to additional Matter
ecosystems.

## Integrate the Mobile SDK into your Android app

To get started, complete the following steps:

1. Follow the instructions provided at
   [Set up Google Play services](https://developers.home.google.com/android/guides/setup).

2. Add the Play services dependency to your `build.gradle` file:

       implementation 'com.google.android.gms:play-services-home:16.0.0-beta1'

### Ensure module delivery

The Play services `home` module is optional, and thus
Matter functionality will only be present on a user's
device if an app on the device specifies the appropriate
Play services module dependency in its `AndroidManifest.xml` file.

The GHA and Google Home Sample App for Matter both include this
module dependency in their manifest. If you are integrating the
Mobile SDK into your Android app, to ensure
Matter support for users of your app, add the
following `service` block to the `application` declaration within your
`AndroidManifest.xml` file:

    <service android:name="com.google.android.gms.metadata.ModuleDependencies"
        android:enabled="false"
        android:exported="false">
        <intent-filter>
            <action android:name="com.google.android.gms.metadata.MODULE_DEPENDENCIES" />
        </intent-filter>

        <meta-data android:name="home:0:preferred" android:value=""/>
    </service>

This is only supported for Android devices running
Play services 22.50.14 or higher.

See the [Sample App for Matter's
manifest](https://github.com/google-home/sample-apps-for-matter-android/blob/ee118020ca56c51e2231d6972902b949de5607d5/3p-ecosystem/src/main/AndroidManifest.xml#L70)
for an example implementation.

You can check the Home module availability at runtime by using
`ModuleInstallClient`. See the
[Ensuring API availability with ModuleInstallClient](https://developers.google.com/android/guides/module-install-apis)
page for more information.

### Calling other Android apps

If you are using Android 11 or higher, you need to include the following
`queries` block in the `AndroidManifest.xml` so that your app can make calls to
other apps.

    <queries>
        <!-- For GMS Core/Play service -->
            <package android:name="com.google.android.gms" />
            <package android:name="com.android.vending" />
        <!-- End of GMS Core/Play service-->
    </queries>

For more information, see the
[Package visibility filtering on Android](https://developer.android.com/training/package-visibility) article.

## Use the Google Home Sample App for Matter

To learn how the Mobile SDK works from an Android app, try
our Sample App for Matter.

[Try the Sample App for Matter](https://developers.home.google.com/samples/matter-app.md.txt)

## Build your own app

To help you get started fast, we've open-sourced the
Sample App for Matter and provided a companion codelab, allowing you to
customize our sample code for your own Android projects.

[Go to the Sample App for Matter codelab](https://developers.home.google.com/codelabs/matter-sample-app)

## Resources

To learn more about the Mobile SDK, refer to the
[API Reference](https://developers.home.google.com/reference/com/google/android/gms/home/matter/package-summary.md.txt).

To learn how this SDK handles end-user data, refer to the [Home Mobile SDK Google Play Data Safety Section](https://developers.home.google.com/matter/apis/home/data-disclosure.md.txt)