CINXE.COM
Thread Network SDK for Android | Google Home Developers
<!doctype html> <html lang="en" dir="ltr"> <head> <meta name="google-signin-client-id" content="721724668570-nbkv1cfusk7kk4eni4pjvepaus73b13t.apps.googleusercontent.com"> <meta name="google-signin-scope" content="profile email https://www.googleapis.com/auth/developerprofiles https://www.googleapis.com/auth/developerprofiles.award"> <meta property="og:site_name" content="Google Home Developers"> <meta property="og:type" content="website"><meta name="theme-color" content="#00639b"><meta charset="utf-8"> <meta content="IE=Edge" http-equiv="X-UA-Compatible"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="manifest" href="/_pwa/home/manifest.json" crossorigin="use-credentials"> <link rel="preconnect" href="//www.gstatic.com" crossorigin> <link rel="preconnect" href="//fonts.gstatic.com" crossorigin> <link rel="preconnect" href="//fonts.googleapis.com" crossorigin> <link rel="preconnect" href="//apis.google.com" crossorigin> <link rel="preconnect" href="//www.google-analytics.com" crossorigin><link rel="stylesheet" href="//fonts.googleapis.com/css?family=Google+Sans:400,500|Roboto:400,400italic,500,500italic,700,700italic|Roboto+Mono:400,500,700&display=swap"> <link rel="stylesheet" href="//fonts.googleapis.com/css2?family=Material+Icons&family=Material+Symbols+Outlined&display=block"><link rel="stylesheet" href="https://www.gstatic.com/devrel-devsite/prod/v870e399c64f7c43c99a3043db4b3a74327bb93d0914e84a0c3dba90bbfd67625/home/css/app.css"> <link rel="shortcut icon" href="https://www.gstatic.com/devrel-devsite/prod/v870e399c64f7c43c99a3043db4b3a74327bb93d0914e84a0c3dba90bbfd67625/home/images/favicon.png"> <link rel="apple-touch-icon" href="https://www.gstatic.com/devrel-devsite/prod/v870e399c64f7c43c99a3043db4b3a74327bb93d0914e84a0c3dba90bbfd67625/home/images/touchicon-180.png"><link rel="canonical" href="https://developers.home.google.com/thread"><link rel="search" type="application/opensearchdescription+xml" title="Google Home Developers" href="https://developers.home.google.com/s/opensearch.xml"> <title>Thread Network SDK for Android | Google Home Developers</title> <meta property="og:title" content="Thread Network SDK for Android | Google Home Developers"><meta name="description" content="An IPv6-based networking protocol designed for low-power Internet of Things devices in an IEEE 802.15.4-2006 wireless mesh network. "> <meta property="og:description" content="An IPv6-based networking protocol designed for low-power Internet of Things devices in an IEEE 802.15.4-2006 wireless mesh network. "><meta property="og:url" content="https://developers.home.google.com/thread"><meta property="og:image" content="https://developers.home.google.com/static/images/home-logo-share.png"> <meta property="og:image:width" content="1200"> <meta property="og:image:height" content="675"><meta property="og:locale" content="en"><meta name="twitter:card" content="summary_large_image"><script type="application/ld+json"> { "@context": "https://schema.org", "@type": "Article", "dateModified": "2022-10-13", "headline": "Thread Network SDK for Android" } </script> <link rel="stylesheet" href="/extras.css"></head> <body class="" template="page" theme="home-theme" type="article" layout="docs" display-toc pending> <devsite-progress type="indeterminate" id="app-progress"></devsite-progress> <section class="devsite-wrapper"> <devsite-cookie-notification-bar></devsite-cookie-notification-bar><devsite-header role="banner"> <div class="devsite-header--inner nocontent"> <div class="devsite-top-logo-row-wrapper-wrapper"> <div class="devsite-top-logo-row-wrapper"> <div class="devsite-top-logo-row"> <button type="button" id="devsite-hamburger-menu" class="devsite-header-icon-button button-flat material-icons gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Navigation menu button" visually-hidden aria-label="Open menu"> </button> <div class="devsite-product-name-wrapper"> <a href="/" class="devsite-site-logo-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Site logo" track-type="globalNav" track-name="googleHomeDevelopers" track-metadata-position="nav" track-metadata-eventDetail="nav"> <picture> <img src="https://www.gstatic.com/devrel-devsite/prod/v870e399c64f7c43c99a3043db4b3a74327bb93d0914e84a0c3dba90bbfd67625/home/images/lockup.svg" class="devsite-site-logo" alt="Google Home Developers"> </picture> </a> <span class="devsite-product-name"> <ul class="devsite-breadcrumb-list" > <li class="devsite-breadcrumb-item "> </li> </ul> </span> </div> <div class="devsite-top-logo-row-middle"> <div class="devsite-header-upper-tabs"> <devsite-tabs class="upper-tabs"> <nav class="devsite-tabs-wrapper" aria-label="Upper tabs"> <tab class="devsite-dropdown "> <a href="https://developers.home.google.com/ways-to-build" track-metadata-eventdetail="https://developers.home.google.com/ways-to-build" class="devsite-tabs-content gc-analytics-event " track-type="nav" track-metadata-position="nav - ways to build" track-metadata-module="primary nav" data-category="Site-Wide Custom Events" data-label="Tab: Ways to build" track-name="ways to build" > Ways to build </a> <a href="#" role="button" aria-haspopup="true" aria-expanded="false" aria-label="Dropdown menu for Ways to build" track-type="nav" track-metadata-eventdetail="https://developers.home.google.com/ways-to-build" track-metadata-position="nav - ways to build" track-metadata-module="primary nav" data-category="Site-Wide Custom Events" data-label="Tab: Ways to build" track-name="ways to build" class="devsite-tabs-dropdown-toggle devsite-icon devsite-icon-arrow-drop-down"></a> <div class="devsite-tabs-dropdown" aria-label="submenu" hidden> <div class="devsite-tabs-dropdown-content"> <div class="devsite-tabs-dropdown-column "> <ul class="devsite-tabs-dropdown-section "> <li class="devsite-nav-title" role="heading" tooltip>Works with Google Home™ badging program</li> <li class="devsite-nav-item"> <a href="https://developers.home.google.com/matter" track-type="nav" track-metadata-eventdetail="https://developers.home.google.com/matter" track-metadata-position="nav - ways to build" track-metadata-module="tertiary nav" track-metadata-module_headline="works with google home™ badging program" tooltip data-label="Matter" data-category="Dropdown Ways to Build" > <div class="devsite-nav-item-title"> Matter </div> <div class="devsite-nav-item-description"> New connectivity protocol for more reliability & lower latency </div> </a> </li> <li class="devsite-nav-item"> <a href="https://developers.home.google.com/cloud-to-cloud" track-type="nav" track-metadata-eventdetail="https://developers.home.google.com/cloud-to-cloud" track-metadata-position="nav - ways to build" track-metadata-module="tertiary nav" track-metadata-module_headline="works with google home™ badging program" tooltip data-label="Cloud-to-cloud" data-category="Dropdown Ways to Build" > <div class="devsite-nav-item-title"> Cloud-to-cloud </div> <div class="devsite-nav-item-description"> Connect your cloud backend with the Smart Home API </div> </a> </li> <li class="devsite-nav-item"> <a href="https://developers.home.google.com/local-home" track-type="nav" track-metadata-eventdetail="https://developers.home.google.com/local-home" track-metadata-position="nav - ways to build" track-metadata-module="tertiary nav" track-metadata-module_headline="works with google home™ badging program" tooltip data-label="Local Home SDK" data-category="Dropdown Ways to Build" > <div class="devsite-nav-item-title"> Local Home SDK </div> <div class="devsite-nav-item-description"> Add a local fulfillment path to route smart home intents </div> </a> </li> </ul> </div> <div class="devsite-tabs-dropdown-column home-dropdown-column"> <ul class="devsite-tabs-dropdown-section "> <li class="devsite-nav-item"> <a href="https://developers.home.google.com/apis" track-type="nav" track-metadata-eventdetail="https://developers.home.google.com/apis" track-metadata-position="nav - ways to build" track-metadata-module="tertiary nav" tooltip data-label="Home APIs" data-category="Dropdown Ways to Build" > <div class="devsite-nav-item-title"> Home APIs </div> <div class="devsite-nav-item-description"> Leverage Google Home devices, infrastructure, and intelligence in your own app </div> </a> </li> <li class="devsite-nav-item"> <a href="https://developers.home.google.com/device-sdk" track-type="nav" track-metadata-eventdetail="https://developers.home.google.com/device-sdk" track-metadata-position="nav - ways to build" track-metadata-module="tertiary nav" tooltip data-label="Device SDK" data-category="Dropdown Ways to Build" > <div class="devsite-nav-item-title"> Google Home Device SDK </div> <div class="devsite-nav-item-description"> Quickly build Matter devices, integrate with Google Home and access Google's intelligence signals </div> </a> </li> <li class="devsite-nav-item"> <a href="https://developers.home.google.com/mobile-sdk" track-type="nav" track-metadata-eventdetail="https://developers.home.google.com/mobile-sdk" track-metadata-position="nav - ways to build" track-metadata-module="tertiary nav" tooltip data-category="Dropdown Ways to Build" data-label="Mobile SDK" > <div class="devsite-nav-item-title"> Google Home Mobile SDK </div> <div class="devsite-nav-item-description"> Build the best Android Matter apps using Google's Play service APIs and Android developer tool </div> </a> </li> </ul> </div> <div class="devsite-tabs-dropdown-column home-dropdown-column"> <ul class="devsite-tabs-dropdown-section "> <li class="devsite-nav-item"> <a href="https://developers.home.google.com/device-access" track-type="nav" track-metadata-eventdetail="https://developers.home.google.com/device-access" track-metadata-position="nav - ways to build" track-metadata-module="tertiary nav" tooltip data-category="Dropdown Ways to Build" data-label="Device Access" target="_blank" > <div class="devsite-nav-item-title"> Device Access </div> <div class="devsite-nav-item-description"> Add ability to manage and control Nest devices into your smart home solution </div> </a> </li> <li class="devsite-nav-item"> <a href="https://developers.home.google.com/cast" track-type="nav" track-metadata-eventdetail="https://developers.home.google.com/cast" track-metadata-position="nav - ways to build" track-metadata-module="tertiary nav" tooltip target="_blank" data-label="Cast SDK" data-category="Dropdown Ways to Build" > <div class="devsite-nav-item-title"> Cast SDK </div> <div class="devsite-nav-item-description"> Turn your app into a remote control and stream audio/video to a Cast-enabled device </div> </a> </li> </ul> </div> </div> </div> </tab> <tab > <a href="https://developers.home.google.com/use-cases" track-metadata-eventdetail="https://developers.home.google.com/use-cases" class="devsite-tabs-content gc-analytics-event " track-type="nav" track-metadata-position="nav - use cases" track-metadata-module="primary nav" data-category="Site-Wide Custom Events" data-label="Tab: Use cases" track-name="use cases" > Use cases </a> </tab> <tab > <a href="https://developers.home.google.com/business-resources" track-metadata-eventdetail="https://developers.home.google.com/business-resources" class="devsite-tabs-content gc-analytics-event " track-type="nav" track-metadata-position="nav - business resources" track-metadata-module="primary nav" data-category="Site-Wide Custom Events" data-label="Tab: Business resources" track-name="business resources" > Business resources </a> </tab> <tab > <a href="https://developers.home.google.com/whats-new" track-metadata-eventdetail="https://developers.home.google.com/whats-new" class="devsite-tabs-content gc-analytics-event " track-type="nav" track-metadata-position="nav - what's new" track-metadata-module="primary nav" data-category="Site-Wide Custom Events" data-label="Tab: What's new" track-name="what's new" > What's new </a> </tab> <tab class="devsite-dropdown devsite-active "> <a href="https://developers.home.google.com/docs" track-metadata-eventdetail="https://developers.home.google.com/docs" class="devsite-tabs-content gc-analytics-event " track-type="nav" track-metadata-position="nav - docs" track-metadata-module="primary nav" aria-label="Docs, selected" data-category="Site-Wide Custom Events" data-label="Tab: Docs" track-name="docs" > Docs </a> <a href="#" role="button" aria-haspopup="true" aria-expanded="false" aria-label="Dropdown menu for Docs" track-type="nav" track-metadata-eventdetail="https://developers.home.google.com/docs" track-metadata-position="nav - docs" track-metadata-module="primary nav" data-category="Site-Wide Custom Events" data-label="Tab: Docs" track-name="docs" class="devsite-tabs-dropdown-toggle devsite-icon devsite-icon-arrow-drop-down"></a> <div class="devsite-tabs-dropdown" aria-label="submenu" hidden> <div class="devsite-tabs-dropdown-content"> <div class="devsite-tabs-dropdown-column "> <ul class="devsite-tabs-dropdown-section "> <li class="devsite-nav-item"> <a href="https://developers.home.google.com/matter/docs" track-type="nav" track-metadata-eventdetail="https://developers.home.google.com/matter/docs" track-metadata-position="nav - docs" track-metadata-module="tertiary nav" tooltip data-label="Matter" data-category="Dropdown Docs" > <div class="devsite-nav-item-title"> Matter </div> <div class="devsite-nav-item-description"> New connectivity protocol for more reliability & lower latency </div> </a> </li> <li class="devsite-nav-item"> <a href="https://developers.home.google.com/cloud-to-cloud/docs" track-type="nav" track-metadata-eventdetail="https://developers.home.google.com/cloud-to-cloud/docs" track-metadata-position="nav - docs" track-metadata-module="tertiary nav" tooltip data-label="Cloud-to-cloud" data-category="Dropdown Docs" > <div class="devsite-nav-item-title"> Cloud-to-cloud </div> <div class="devsite-nav-item-description"> Connect your cloud backend with the Smart Home API </div> </a> </li> <li class="devsite-nav-item"> <a href="https://developers.home.google.com/local-home/docs" track-type="nav" track-metadata-eventdetail="https://developers.home.google.com/local-home/docs" track-metadata-position="nav - docs" track-metadata-module="tertiary nav" tooltip data-label="Local Home SDK" data-category="Dropdown Docs" > <div class="devsite-nav-item-title"> Local Home SDK </div> <div class="devsite-nav-item-description"> Control your devices throughout the Google Home ecosystem </div> </a> </li> </ul> </div> <div class="devsite-tabs-dropdown-column "> <ul class="devsite-tabs-dropdown-section "> <li class="devsite-nav-item"> <a href="https://developers.home.google.com/app-flip" track-type="nav" track-metadata-eventdetail="https://developers.home.google.com/app-flip" track-metadata-position="nav - docs" track-metadata-module="tertiary nav" tooltip data-label="App Flip" data-category="Dropdown Docs" > <div class="devsite-nav-item-title"> App Flip </div> <div class="devsite-nav-item-description"> Allow your users to login to your system seamlessly with their Google accounts </div> </a> </li> <li class="devsite-nav-item"> <a href="https://developers.home.google.com/tools" track-type="nav" track-metadata-eventdetail="https://developers.home.google.com/tools" track-metadata-position="nav - docs" track-metadata-module="tertiary nav" tooltip data-label="Tools" data-category="Dropdown Docs" > <div class="devsite-nav-item-title"> Tools </div> <div class="devsite-nav-item-description"> Experiment, create, test, and debug your integrations with our suite of tools </div> </a> </li> </ul> </div> <div class="devsite-tabs-dropdown-column "> <ul class="devsite-tabs-dropdown-section "> <li class="devsite-nav-item"> <a href="https://developers.home.google.com/thread/docs" track-type="nav" track-metadata-eventdetail="https://developers.home.google.com/thread/docs" track-metadata-position="nav - docs" track-metadata-module="tertiary nav" tooltip data-label="Thread" data-category="Dropdown Docs" > <div class="devsite-nav-item-title"> Thread </div> <div class="devsite-nav-item-description"> An IPv6-based networking protocol designed for low-power Internet of Things devices </div> </a> </li> <li class="devsite-nav-item"> <a href="https://developers.home.google.com/device-access/registration" track-type="nav" track-metadata-eventdetail="https://developers.home.google.com/device-access/registration" track-metadata-position="nav - docs" track-metadata-module="tertiary nav" tooltip target="_blank" data-category="Dropdown Docs" data-label="Device Access" > <div class="devsite-nav-item-title"> Device Access </div> <div class="devsite-nav-item-description"> Add ability to manage and control Nest devices into your smart home solution </div> </a> </li> <li class="devsite-nav-item"> <a href="https://developers.home.google.com/cast/docs/overview" track-type="nav" track-metadata-eventdetail="https://developers.home.google.com/cast/docs/overview" track-metadata-position="nav - docs" track-metadata-module="tertiary nav" tooltip target="_blank" data-category="Dropdown Docs" data-label="Cast SDK" > <div class="devsite-nav-item-title"> Cast SDK </div> <div class="devsite-nav-item-description"> Turn your app into a remote control and stream audio/video to a Cast-enabled device </div> </a> </li> </ul> </div> </div> </div> </tab> </nav> </devsite-tabs> </div> <devsite-search enable-signin enable-search enable-suggestions enable-query-completion project-name="Thread" tenant-name="Google Home Developers" > <form class="devsite-search-form" action="https://developers.home.google.com/s/results" method="GET"> <div class="devsite-search-container"> <button type="button" search-open class="devsite-search-button devsite-header-icon-button button-flat material-icons" aria-label="Open search"></button> <div class="devsite-searchbox"> <input aria-activedescendant="" aria-autocomplete="list" aria-label="Search" aria-expanded="false" aria-haspopup="listbox" autocomplete="off" class="devsite-search-field devsite-search-query" name="q" placeholder="Search" role="combobox" type="text" value="" > <div class="devsite-search-image material-icons" aria-hidden="true"> </div> <div class="devsite-search-shortcut-icon-container" aria-hidden="true"> <kbd class="devsite-search-shortcut-icon">/</kbd> </div> </div> </div> </form> <button type="button" search-close class="devsite-search-button devsite-header-icon-button button-flat material-icons" aria-label="Close search"></button> </devsite-search> </div> <devsite-language-selector> <ul role="presentation"> <li role="presentation"> <a role="menuitem" lang="en" >English</a> </li> <li role="presentation"> <a role="menuitem" lang="de" >Deutsch</a> </li> <li role="presentation"> <a role="menuitem" lang="es" >Español</a> </li> <li role="presentation"> <a role="menuitem" lang="fr" >Français</a> </li> <li role="presentation"> <a role="menuitem" lang="id" >Indonesia</a> </li> <li role="presentation"> <a role="menuitem" lang="it" >Italiano</a> </li> <li role="presentation"> <a role="menuitem" lang="pl" >Polski</a> </li> <li role="presentation"> <a role="menuitem" lang="pt" >Português</a> </li> <li role="presentation"> <a role="menuitem" lang="vi" >Tiếng Việt</a> </li> <li role="presentation"> <a role="menuitem" lang="tr" >Türkçe</a> </li> <li role="presentation"> <a role="menuitem" lang="ru" >Русский</a> </li> <li role="presentation"> <a role="menuitem" lang="he" >עברית</a> </li> <li role="presentation"> <a role="menuitem" lang="ar" >العربيّة</a> </li> <li role="presentation"> <a role="menuitem" lang="fa" >فارسی</a> </li> <li role="presentation"> <a role="menuitem" lang="hi" >हिंदी</a> </li> <li role="presentation"> <a role="menuitem" lang="bn" >বাংলা</a> </li> <li role="presentation"> <a role="menuitem" lang="th" >ภาษาไทย</a> </li> <li role="presentation"> <a role="menuitem" lang="zh_cn" >中文 – 简体</a> </li> <li role="presentation"> <a role="menuitem" lang="zh_tw" >中文 – 繁體</a> </li> <li role="presentation"> <a role="menuitem" lang="ja" >日本語</a> </li> <li role="presentation"> <a role="menuitem" lang="ko" >한국어</a> </li> </ul> </devsite-language-selector> <a class="devsite-header-link devsite-top-button button gc-analytics-event" href="//console.home.google.com" data-category="Site-Wide Custom Events" data-label="Site header link" target="_blank" > Console </a> <devsite-user enable-profiles fp-auth id="devsite-user"> <span class="button devsite-top-button" aria-hidden="true" visually-hidden>Sign in</span> </devsite-user> </div> </div> </div> <div class="devsite-collapsible-section "> <div class="devsite-header-background"> <div class="devsite-product-id-row" > <div class="devsite-product-description-row"> <ul class="devsite-breadcrumb-list" > <li class="devsite-breadcrumb-item "> <a href="https://developers.home.google.com/docs" class="devsite-breadcrumb-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Lower Header" data-value="1" track-type="globalNav" track-name="breadcrumb" track-metadata-position="1" track-metadata-eventdetail="" > Thread </a> </li> </ul> </div> </div> <div class="devsite-doc-set-nav-row"> <devsite-tabs class="lower-tabs"> <nav class="devsite-tabs-wrapper" aria-label="Lower tabs"> <tab class="devsite-active"> <a href="https://developers.home.google.com/thread" track-metadata-eventdetail="https://developers.home.google.com/thread" class="devsite-tabs-content gc-analytics-event " track-type="nav" track-metadata-position="nav - get started" track-metadata-module="primary nav" aria-label="Get Started, selected" data-category="Site-Wide Custom Events" data-label="Tab: Get Started" track-name="get started" > Get Started </a> </tab> <tab > <a href="https://developers.home.google.com/reference/com/google/android/gms/threadnetwork/package-summary" track-metadata-eventdetail="https://developers.home.google.com/reference/com/google/android/gms/threadnetwork/package-summary" class="devsite-tabs-content gc-analytics-event " track-type="nav" track-metadata-position="nav - reference" track-metadata-module="primary nav" data-category="Site-Wide Custom Events" data-label="Tab: Reference" track-name="reference" > Reference </a> </tab> <tab > <a href="https://developers.home.google.com/thread/support" track-metadata-eventdetail="https://developers.home.google.com/thread/support" class="devsite-tabs-content gc-analytics-event " track-type="nav" track-metadata-position="nav - support" track-metadata-module="primary nav" data-category="Site-Wide Custom Events" data-label="Tab: Support" track-name="support" > Support </a> </tab> </nav> </devsite-tabs> </div> </div> </div> </div> </devsite-header> <devsite-book-nav scrollbars > <div class="devsite-book-nav-filter" > <span class="filter-list-icon material-icons" aria-hidden="true"></span> <input type="text" placeholder="Filter" aria-label="Type to filter" role="searchbox"> <span class="filter-clear-button hidden" data-title="Clear filter" aria-label="Clear filter" role="button" tabindex="0"></span> </div> <nav class="devsite-book-nav devsite-nav nocontent" aria-label="Side menu"> <div class="devsite-mobile-header"> <button type="button" id="devsite-close-nav" class="devsite-header-icon-button button-flat material-icons gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Close navigation" aria-label="Close navigation"> </button> <div class="devsite-product-name-wrapper"> <a href="/" class="devsite-site-logo-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Site logo" track-type="globalNav" track-name="googleHomeDevelopers" track-metadata-position="nav" track-metadata-eventDetail="nav"> <picture> <img src="https://www.gstatic.com/devrel-devsite/prod/v870e399c64f7c43c99a3043db4b3a74327bb93d0914e84a0c3dba90bbfd67625/home/images/lockup.svg" class="devsite-site-logo" alt="Google Home Developers"> </picture> </a> <span class="devsite-product-name"> <ul class="devsite-breadcrumb-list" > <li class="devsite-breadcrumb-item "> </li> </ul> </span> </div> </div> <div class="devsite-book-nav-wrapper"> <div class="devsite-mobile-nav-top"> <ul class="devsite-nav-list"> <li class="devsite-nav-item"> <a href="/ways-to-build" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Tab: Ways to build" track-name="ways to build" data-category="Site-Wide Custom Events" data-label="Responsive Tab: Ways to build" track-type="globalNav" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Ways to build </span> </a> <ul class="devsite-nav-responsive-tabs devsite-nav-has-menu "> <li class="devsite-nav-item"> <span class="devsite-nav-title" tooltip data-category="Site-Wide Custom Events" data-label="Tab: Ways to build" track-name="ways to build" > <span class="devsite-nav-text" tooltip menu="Ways to build"> More </span> <span class="devsite-nav-icon material-icons" data-icon="forward" menu="Ways to build"> </span> </span> </li> </ul> </li> <li class="devsite-nav-item"> <a href="/use-cases" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Tab: Use cases" track-name="use cases" data-category="Site-Wide Custom Events" data-label="Responsive Tab: Use cases" track-type="globalNav" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Use cases </span> </a> </li> <li class="devsite-nav-item"> <a href="/business-resources" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Tab: Business resources" track-name="business resources" data-category="Site-Wide Custom Events" data-label="Responsive Tab: Business resources" track-type="globalNav" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Business resources </span> </a> </li> <li class="devsite-nav-item"> <a href="/whats-new" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Tab: What's new" track-name="what's new" data-category="Site-Wide Custom Events" data-label="Responsive Tab: What's new" track-type="globalNav" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > What's new </span> </a> </li> <li class="devsite-nav-item"> <a href="/docs" class="devsite-nav-title gc-analytics-event devsite-nav-active" data-category="Site-Wide Custom Events" data-label="Tab: Docs" track-name="docs" data-category="Site-Wide Custom Events" data-label="Responsive Tab: Docs" track-type="globalNav" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Docs </span> </a> <ul class="devsite-nav-responsive-tabs devsite-nav-has-menu "> <li class="devsite-nav-item"> <span class="devsite-nav-title" tooltip data-category="Site-Wide Custom Events" data-label="Tab: Docs" track-name="docs" > <span class="devsite-nav-text" tooltip menu="Docs"> More </span> <span class="devsite-nav-icon material-icons" data-icon="forward" menu="Docs"> </span> </span> </li> </ul> <ul class="devsite-nav-responsive-tabs"> <li class="devsite-nav-item"> <a href="/thread" class="devsite-nav-title gc-analytics-event devsite-nav-has-children devsite-nav-active" data-category="Site-Wide Custom Events" data-label="Tab: Get Started" track-name="get started" data-category="Site-Wide Custom Events" data-label="Responsive Tab: Get Started" track-type="globalNav" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip menu="_book"> Get Started </span> <span class="devsite-nav-icon material-icons" data-icon="forward" menu="_book"> </span> </a> </li> <li class="devsite-nav-item"> <a href="/reference/com/google/android/gms/threadnetwork/package-summary" class="devsite-nav-title gc-analytics-event devsite-nav-has-children " data-category="Site-Wide Custom Events" data-label="Tab: Reference" track-name="reference" data-category="Site-Wide Custom Events" data-label="Responsive Tab: Reference" track-type="globalNav" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Reference </span> <span class="devsite-nav-icon material-icons" data-icon="forward" > </span> </a> </li> <li class="devsite-nav-item"> <a href="/thread/support" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Tab: Support" track-name="support" data-category="Site-Wide Custom Events" data-label="Responsive Tab: Support" track-type="globalNav" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Support </span> </a> </li> </ul> </li> <li class="devsite-nav-item"> <a href="//console.home.google.com" class="devsite-nav-title gc-analytics-event " target="_blank" data-category="Site-Wide Custom Events" data-label="Responsive Tab: Console" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Console </span> </a> </li> </ul> </div> <div class="devsite-mobile-nav-bottom"> <ul class="devsite-nav-list" menu="_book"> <li class="devsite-nav-item"><a href="/thread" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /thread" track-type="bookNav" track-name="click" track-metadata-eventdetail="/thread" ><span class="devsite-nav-text" tooltip>Overview</span></a></li> <li class="devsite-nav-item"><a href="/thread/release-notes" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /thread/release-notes" track-type="bookNav" track-name="click" track-metadata-eventdetail="/thread/release-notes" ><span class="devsite-nav-text" tooltip>Release notes</span></a></li> <li class="devsite-nav-item devsite-nav-heading"><div class="devsite-nav-title devsite-nav-title-no-path"> <span class="devsite-nav-text" tooltip>Learn</span> </div></li> <li class="devsite-nav-item devsite-nav-external"><a href="https://openthread.io/guides/thread-primer" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: https://openthread.io/guides/thread-primer" track-type="bookNav" track-name="click" track-metadata-eventdetail="https://openthread.io/guides/thread-primer" target="_blank"><span class="devsite-nav-text" tooltip>Thread Primer</span><span class="devsite-nav-icon material-icons" data-icon="external" data-title="External" aria-hidden="true"></span></a></li> <li class="devsite-nav-item devsite-nav-external"><a href="/thread/support" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /thread/support" track-type="bookNav" track-name="click" track-metadata-eventdetail="/thread/support" ><span class="devsite-nav-text" tooltip>Support</span><span class="devsite-nav-icon material-icons" data-icon="external" data-title="External" aria-hidden="true"></span></a></li> <li class="devsite-nav-item devsite-nav-heading"><div class="devsite-nav-title devsite-nav-title-no-path"> <span class="devsite-nav-text" tooltip>Codelabs</span> </div></li> <li class="devsite-nav-item"><a href="/codelabs/thread-sharing-apis" class="devsite-nav-title gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Book nav link, pathname: /codelabs/thread-sharing-apis" track-type="bookNav" track-name="click" track-metadata-eventdetail="/codelabs/thread-sharing-apis" ><span class="devsite-nav-text" tooltip>Sharing the Thread Network With Google Thread Credentials APIs</span></a></li> </ul> <ul class="devsite-nav-list" menu="Ways to build" aria-label="Side menu" hidden> <li class="devsite-nav-item devsite-nav-heading"> <span class="devsite-nav-title" tooltip > <span class="devsite-nav-text" tooltip > Works with Google Home™ badging program </span> </span> </li> <li class="devsite-nav-item"> <a href="/matter" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Matter" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Matter </span> </a> </li> <li class="devsite-nav-item"> <a href="/cloud-to-cloud" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Cloud-to-cloud" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Cloud-to-cloud </span> </a> </li> <li class="devsite-nav-item"> <a href="/local-home" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Local Home SDK" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Local Home SDK </span> </a> </li> <li class="devsite-nav-item"> <a href="/apis" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Home APIs" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Home APIs </span> </a> </li> <li class="devsite-nav-item"> <a href="/device-sdk" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Google Home Device SDK" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Google Home Device SDK </span> </a> </li> <li class="devsite-nav-item"> <a href="/mobile-sdk" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Google Home Mobile SDK" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Google Home Mobile SDK </span> </a> </li> <li class="devsite-nav-item"> <a href="/device-access" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Device Access" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Device Access </span> </a> </li> <li class="devsite-nav-item"> <a href="/cast" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Cast SDK" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Cast SDK </span> </a> </li> </ul> <ul class="devsite-nav-list" menu="Docs" aria-label="Side menu" hidden> <li class="devsite-nav-item"> <a href="/matter/docs" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Matter" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Matter </span> </a> </li> <li class="devsite-nav-item"> <a href="/cloud-to-cloud/docs" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Cloud-to-cloud" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Cloud-to-cloud </span> </a> </li> <li class="devsite-nav-item"> <a href="/local-home/docs" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Local Home SDK" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Local Home SDK </span> </a> </li> <li class="devsite-nav-item"> <a href="/app-flip" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: App Flip" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > App Flip </span> </a> </li> <li class="devsite-nav-item"> <a href="/tools" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Tools" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Tools </span> </a> </li> <li class="devsite-nav-item"> <a href="/thread/docs" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Thread" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Thread </span> </a> </li> <li class="devsite-nav-item"> <a href="/device-access/registration" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Device Access" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Device Access </span> </a> </li> <li class="devsite-nav-item"> <a href="/cast/docs/overview" class="devsite-nav-title gc-analytics-event " data-category="Site-Wide Custom Events" data-label="Responsive Tab: Cast SDK" track-type="navMenu" track-metadata-eventDetail="globalMenu" track-metadata-position="nav"> <span class="devsite-nav-text" tooltip > Cast SDK </span> </a> </li> </ul> </div> </div> </nav> </devsite-book-nav> <section id="gc-wrapper"> <main role="main" class="devsite-main-content" has-book-nav has-sidebar > <div class="devsite-sidebar"> <div class="devsite-sidebar-content"> <devsite-toc class="devsite-nav" role="navigation" aria-label="On this page" depth="2" scrollbars ></devsite-toc> <devsite-recommendations-sidebar class="nocontent devsite-nav"> </devsite-recommendations-sidebar> </div> </div> <devsite-content> <article class="devsite-article"> <div class="devsite-article-meta nocontent" role="navigation"> <ul class="devsite-breadcrumb-list" aria-label="Breadcrumb"> <li class="devsite-breadcrumb-item "> <a href="https://developers.home.google.com/" class="devsite-breadcrumb-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Breadcrumbs" data-value="1" track-type="globalNav" track-name="breadcrumb" track-metadata-position="1" track-metadata-eventdetail="Google Home Developers" > Google Home Developers </a> </li> <li class="devsite-breadcrumb-item "> <div class="devsite-breadcrumb-guillemet material-icons" aria-hidden="true"></div> <a href="https://developers.home.google.com/docs" class="devsite-breadcrumb-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Breadcrumbs" data-value="2" track-type="globalNav" track-name="breadcrumb" track-metadata-position="2" track-metadata-eventdetail="Docs" > Docs </a> </li> <li class="devsite-breadcrumb-item "> <div class="devsite-breadcrumb-guillemet material-icons" aria-hidden="true"></div> <a href="https://developers.home.google.com/thread" class="devsite-breadcrumb-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Breadcrumbs" data-value="3" track-type="globalNav" track-name="breadcrumb" track-metadata-position="3" track-metadata-eventdetail="Thread" > Thread </a> </li> </ul> </div> <h1 class="devsite-page-title" tabindex="-1"> Thread Network SDK for Android </h1> <devsite-feature-tooltip ack-key="AckCollectionsBookmarkTooltipDismiss" analytics-category="Site-Wide Custom Events" analytics-action-show="Callout Profile displayed" analytics-action-close="Callout Profile dismissed" analytics-label="Create Collection Callout" class="devsite-page-bookmark-tooltip nocontent" dismiss-button="true" id="devsite-collections-dropdown" dismiss-button-text="Dismiss" close-button-text="Got it"> <devsite-bookmark></devsite-bookmark> <span slot="popout-heading"> Stay organized with collections </span> <span slot="popout-contents"> Save and categorize content based on your preferences. </span> </devsite-feature-tooltip> <div class="devsite-page-title-meta"><devsite-view-release-notes></devsite-view-release-notes></div> <devsite-toc class="devsite-nav" depth="2" devsite-toc-embedded > </devsite-toc> <div class="devsite-article-body clearfix "> <p>The Thread Network SDK provides functionality that's similar to a digital keychain, allowing your Android apps to share Thread network credentials with Google Play services. This allows your apps to set up any Thread device from any smart home ecosystem, without exposing credentials and user data directly.</p> <p>With just a few API calls, you can:</p> <ol> <li>Request preferred Thread network credentials from Google Play services.</li> <li>Set up new border routers and add your Thread network credentials to Google Play services.</li> <li>If you already have in-field border routers, you can check if your border routers are in the preferred network and migrate them, if necessary.</li> </ol> <p>There are several user and developer journeys to consider. We'll cover most of them in this guide, along with other key features and recommended usage.</p> <aside class="note"><strong>Note:</strong><span> Starting from version <code translate="no" dir="ltr">16.0.0</code>, the Thread Network SDK supports Android 8.0+ (API level 26+). But for Android 8.0, mobile phones won't be able to connect to Thread end devices because <a href="https://www.rfc-editor.org/rfc/rfc4191#section-2.3">Route Information Option</a> (RIO) is only supported on Android 8.1+.</span></aside> <h2 id="key_terminology_and_api_concepts" data-text="Key terminology and API concepts" tabindex="-1">Key terminology and API concepts</h2> <p>Before you get started, it's helpful to understand the following terms:</p> <ul> <li><p><strong>Thread Network Credentials:</strong> Binary blob of Thread TLVs that encodes Thread Network Name, Network Key and other properties that are required by a Thread device to join a given Thread network.</p></li> <li><p><strong>Preferred Thread Network Credentials:</strong> The auto-selected Thread network credentials that can be shared with apps of different vendors using the <code translate="no" dir="ltr">getPreferredCredentials</code> API.</p></li> <li><p><strong>Border Agent ID:</strong> A 16-byte globally unique ID for a Thread Border Router device. This ID is created and managed by border router vendors.</p></li> <li><p><strong>Thread Border Router Setup app:</strong> This is your Android app that sets up new Thread Border Router devices and adds the Thread network credentials to Google Play services. Your app is the authoritative owner of the added credentials and has access to them.</p></li> </ul> <p>Many of the Thread Network APIs return a <a href="/android/reference/com/google/android/gms/tasks/Task">Task</a> that completes asynchronously. You can use <a href="/android/reference/com/google/android/gms/tasks/Task#public-abstract-tasktresult-addonsuccesslistener-onsuccesslistener-super-tresult-listener">addOnSuccessListener</a> and <a href="/android/reference/com/google/android/gms/tasks/Task#public-abstract-tasktresult-addonfailurelistener-onfailurelistener-listener">addOnFailureListener</a> to register callbacks for receiving the result. To learn more, refer to the <a href="/android/reference/com/google/android/gms/tasks/Task">Task</a> documentation.</p> <h2 id="credentials_ownership_and_maintenance" data-text="Credentials ownership and maintenance" tabindex="-1">Credentials ownership and maintenance</h2> <p>The app that adds the Thread network credentials becomes the owner of the credentials, and has full permissions to access to the credentials. If you try to access credentials added by other apps, you'll receive a <code translate="no" dir="ltr">PERMISSION_DENIED</code> error.</p> <p>As the app owner, it's recommended that you keep credentials stored in Google Play services up-to-date when the Thread Border Router network is updated. This means adding credentials when required, updating credentials when the border router's Thread network credentials change, and removing credentials when the Thread Border Router is removed or factory reset.</p> <h2 id="border_agent_discovery" data-text="Border Agent discovery" tabindex="-1">Border Agent discovery</h2> <p>Credentials must be saved with a Border Agent ID. You'll need to make sure that your Thread Border Router Setup app is able to determine the Border Agent IDs of your Thread border routers.</p> <p>Thread Border Routers must use mDNS to advertise Thread network information, including the Network Name, Extended Pan ID, and Border Agent ID. The corresponding <code translate="no" dir="ltr">txt</code> values for these attributes are <code translate="no" dir="ltr">nn</code>, <code translate="no" dir="ltr">xp</code>, and <code translate="no" dir="ltr">id</code>, respectively.</p> <aside class="note"><strong>Note:</strong><span> It's important for the Border Router device to include a 16-byte <code translate="no" dir="ltr">id</code> TXT value in its MeshCoP mDNS service for Google Play services to discover and identify the Thread network. For products using the open source <a href="https://github.com/openthread/ot-br-posix">ot-br-posix</a>, make sure that the <code translate="no" dir="ltr">OTBR_PUBLISH_MESHCOP_BA_ID</code> feature is enabled.</span></aside> <p>For networks with Google border routers, Google Play services automatically gets Google Thread network credentials for use.</p> <h2 id="integrate_the_sdk_into_your_android_app" data-text="Integrate the SDK into your Android app" tabindex="-1">Integrate the SDK into your Android app</h2> <p>To get started, complete the following steps:</p> <ol> <li><p>Follow the instructions provided at <a href="/android/guides/setup">Set up Google Play services</a>.</p></li> <li><p>Add the Google Play services dependency to your <code translate="no" dir="ltr">build.gradle</code> file:</p> <pre class="prettyprint lang-kotlin" translate="no" dir="ltr"><code translate="no" dir="ltr">implementation 'com.google.android.gms:play-services-threadnetwork:16.2.1' </code></pre></li> <li><p><em>Optional:</em> Define a <code translate="no" dir="ltr">BorderAgent</code> data class to store border router information. We'll use this data throughout this guide:</p> <pre class="prettyprint lang-kotlin" translate="no" dir="ltr"><code translate="no" dir="ltr">data class BorderAgentInfo( // Network Name max 16 len val networkName: String = "", val extPanId: ByteArray = ByteArray(16), val borderAgentId: ByteArray = ByteArray(16), ... ) </code></pre></li> </ol> <p>Next, we'll go over the recommended steps to add and manage preferred credentials.</p> <h2 id="new_border_router_setups" data-text="New border router setups" tabindex="-1">New border router setups</h2> <p>Before you create a new network for new border routers, it's important that you try using the preferred network credentials first. This ensures that Thread devices are connected to a single Thread network when possible.</p> <p>A call to <code translate="no" dir="ltr">getPreferredCredentials</code> launches an Activity, prompting users to allow the network request. If network credentials have been stored in the Thread SDK digital keychain, the credentials are returned to your app.</p> <h3 id="request_credentials" data-text="Request credentials" tabindex="-1">Request credentials</h3> <p>To prompt the user for preferred credentials:</p> <ol> <li><p>Declare an <code translate="no" dir="ltr">ActivityLauncher</code>:</p> <pre class="prettyprint lang-kotlin" translate="no" dir="ltr"><code translate="no" dir="ltr">private lateinit var preferredCredentialsLauncher: ActivityResultLauncher<IntentSenderRequest> </code></pre></li> <li><p>Handle the Activity result, returned as <code translate="no" dir="ltr">ThreadNetworkCredentials</code>:</p> <pre class="prettyprint lang-kotlin" translate="no" dir="ltr"><code translate="no" dir="ltr">preferredCredentialsLauncher = registerForActivityResult( StartIntentSenderForResult() ) { result: ActivityResult -> if (result.resultCode == RESULT_OK) { val threadNetworkCredentials = ThreadNetworkCredentials.fromIntentSenderResultData(result.data!!) Log.d("debug", threadNetworkCredentials.networkName) } else { Log.d("debug", "User denied request.") } } </code></pre></li> <li><p>If you're setting up a new Thread Border Router, it's advised that you call <code translate="no" dir="ltr">preferredCredentials</code> and launch the Activity. This call will ensure that your new Thread Border Router will use the same credentials already stored as <em>preferred</em> in the phone, promoting the convergence of different TBRs to the same network.</p> <pre class="prettyprint lang-kotlin" translate="no" dir="ltr"><code translate="no" dir="ltr">private fun getPreferredThreadNetworkCredentials() { ThreadNetwork.getClient(this) .preferredCredentials .addOnSuccessListener { intentSenderResult -> intentSenderResult.intentSender?.let { preferredCredentialsLauncher.launch(IntentSenderRequest.Builder(it).build()) } ?: Log.d("debug", "No preferred credentials found.") } .addOnFailureListener { e: Exception -> Log.d(TAG, "ERROR: [${e}]") } } </code></pre></li> <li><p>If your use case relates to setting up non-TBR devices, such as a new Matter-over-Thread end device, it's advised that you use the <code translate="no" dir="ltr">allActiveCredentials</code> api to fetch credentials. This call will scan for TBRs found in the local network and thus won't return credentials that are not available by an existing TBR locally.</p> <pre class="prettyprint lang-kotlin" translate="no" dir="ltr"><code translate="no" dir="ltr">// Creates the IntentSender result launcher for the getAllActiveCredentials API private val getAllActiveCredentialsLauncher = registerForActivityResult( StartIntentSenderForResult() ) { result: ActivityResult -> if (result.resultCode == RESULT_OK) { val activeCredentials: List<ThreadNetworkCredentials> = ThreadNetworkCredentials.parseListFromIntentSenderResultData( result.data!! ) // Use the activeCredentials list } else { // The user denied to share! } } // Invokes the getAllActiveCredentials API and starts the dialog activity with the returned // IntentSender threadNetworkClient .getAllActiveCredentials() .addOnSuccessListener { intentSenderResult: IntentSenderResult -> val intentSender = intentSenderResult.intentSender if (intentSender != null) { getAllActiveCredentialsLauncher.launch( IntentSenderRequest.Builder(intentSender).build() ) } else { // No active network credentials found! } } // Handles the failure .addOnFailureListener { e: Exception -> // Handle the exception } </code></pre></li> </ol> <h3 id="create_a_new_thread_network" data-text="Create a new Thread network" tabindex="-1">Create a new Thread network</h3> <p>If there are neither preferred Thread network credentials nor active thread credentials available in a user's Thread network, then you can use the <code translate="no" dir="ltr">addCredentials</code> API to add credentials to Google Play Services. To do this, you'll need to create a <code translate="no" dir="ltr">ThreadBorderAgent</code>, and also supply a <code translate="no" dir="ltr">ThreadNetworkCredentials</code> object.</p> <p>To create a random network, call the <code translate="no" dir="ltr">newRandomizeBuilder</code>:</p> <pre class="prettyprint lang-kotlin" translate="no" dir="ltr"><code translate="no" dir="ltr">val threadCredentials = ThreadNetworkCredentials.newRandomizedBuilder().build() </code></pre> <p>To specify the Thread network Name:</p> <pre class="prettyprint lang-kotlin" translate="no" dir="ltr"><code translate="no" dir="ltr">val threadCredentials = ThreadNetworkCredentials.newRandomizedBuilder() .setNetworkName("ThreadNetworkSDK") .build() </code></pre> <h3 id="add_credentials" data-text="Add credentials" tabindex="-1">Add credentials</h3> <p>To make your Thread network credentials available for other Thread vendors, we need to add them to Google Play services. Before we can add our new credentials, we also need to know to which border router device this Thread network belongs to.</p> <p>In this example, we'll create a <code translate="no" dir="ltr">ThreadBorderAgent</code> from a Border Agent ID, and pass the new Thread network credentials that you just created:</p> <pre class="prettyprint lang-kotlin" translate="no" dir="ltr"><code translate="no" dir="ltr">private fun addCredentials(borderAgentInfo: BorderAgentInfo, credentialsToBeAdded: ThreadNetworkCredentials) { val threadBorderAgent = ThreadBorderAgent.newBuilder(borderAgentInfo.borderAgentId).build() Log.d("debug", "border router id:" + threadBorderAgent.id) ThreadNetwork.getClient(this) .addCredentials(threadBorderAgent, credentialsToBeAdded) .addOnSuccessListener { Log.d("debug", "Credentials added.") } .addOnFailureListener { e: Exception -> Log.d(TAG, "ERROR: [${e}]") } } </code></pre><aside class="note"><strong>Note:</strong><span> The Border Agent ID <strong>MUST</strong> be the <code translate="no" dir="ltr">id</code> TXT value of the Border Router mDNS MeshCoP service.</span></aside><aside class="note"><strong>Note:</strong><span> You should use <code translate="no" dir="ltr">addCredentials</code> to update the preferred credentials when a border router's Thread network credentials change. Existing Thread network credentials that are associated with the same border router will be overwritten.</span></aside> <h2 id="detect_and_migrate_in-field_border_routers" data-text="Detect and migrate in-field border routers" tabindex="-1">Detect and migrate in-field border routers</h2> <p>If you currently have in-field border routers, you can use <code translate="no" dir="ltr">isPreferredCredentials</code> to determine if your border routers belong to the preferred network. This API does not prompt the user for permission, and checks border router credentials against what's stored in Google Play services.</p> <p><code translate="no" dir="ltr">isPreferredCredentails</code> returns <code translate="no" dir="ltr">0</code> for not matched, and <code translate="no" dir="ltr">1</code> for matched, as an <code translate="no" dir="ltr">Int</code> datatype. You can use <code translate="no" dir="ltr">IsPreferredCredentialsResult</code> to check your results.</p> <pre class="prettyprint" translate="no" dir="ltr"><code translate="no" dir="ltr">public @interface IsPreferredCredentialsResult { int PREFERRED_CREDENTIALS_NOT_FOUND = -1; int PREFERRED_CREDENTIALS_NOT_MATCHED = 0; int PREFERRED_CREDENTIALS_MATCHED = 1; } </code></pre> <p>To use <code translate="no" dir="ltr">isPreferredCredentials</code>, you'll need to create a <code translate="no" dir="ltr">ThreadNetworkCredentials</code> object first. There are several ways to instantiate <code translate="no" dir="ltr">ThreadNetworkCredentials</code>. In the next steps, we'll go over these options.</p> <h3 id="thread_network_credentials_by_operational_dataset" data-text="Thread network credentials by Operational Dataset" tabindex="-1">Thread network credentials by Operational Dataset</h3> <p>There are cases that your Thread Border Router is already set up with a Thread network, and you want to add this Thread network to Google Play services to share it with other vendors. You can create a <code translate="no" dir="ltr">ThreadNetworkCredential</code> instance from a raw Thread Active Operational Dataset TLV list:</p> <ol> <li><p>Convert the Operational Dataset to a <code translate="no" dir="ltr">ByteArray</code>. For example:</p> <pre class="prettyprint" translate="no" dir="ltr"><code translate="no" dir="ltr">val activeDataset = "0e080000000000010000000300000f35060004001fffe0020833333333...".dsToByteArray() </code></pre><pre class="prettyprint" translate="no" dir="ltr"><code translate="no" dir="ltr">fun String.dsToByteArray(): ByteArray { return chunked(2).map { it.toInt(16).toByte() }.toByteArray() } </code></pre></li> <li><p>Use <code translate="no" dir="ltr">fromActiveOperationalDataset</code> to create the <code translate="no" dir="ltr">ThreadNetworkCredentials</code>. When successful, you'll be able to get the Thread network Name, Channel, and other network information. For a complete list of properties, refer to <a href="/reference/com/google/android/gms/threadnetwork/ThreadNetworkCredentials">ThreadNetworkCredentials</a>.</p> <pre class="prettyprint" translate="no" dir="ltr"><code translate="no" dir="ltr">val threadNetworkCredentials = ThreadNetworkCredentials.fromActiveOperationalDataset(activeDataset) Log.d( "threadNetworkCredentials", threadNetworkCredentials.channel.toString() + " - " + threadNetworkCredentials.networkName) </code></pre></li> <li><p>Call the <code translate="no" dir="ltr">isPreferredCredentials</code> API and pass the <code translate="no" dir="ltr">ThreadNetworkCredentials</code>.</p> <pre class="prettyprint" translate="no" dir="ltr"><code translate="no" dir="ltr">ThreadNetwork.getClient(this) .isPreferredCredentials(threadNetworkCredentials) .addOnSuccessListener { result -> when (result) { IsPreferredCredentialsResult.PREFERRED_CREDENTIALS_NOT_MATCHED -> Log.d("isPreferredCredentials", "Credentials not matched.") IsPreferredCredentialsResult.PREFERRED_CREDENTIALS_MATCHED -> Log.d("isPreferredCredentials", "Credentials matched.") } } .addOnFailureListener { e: Exception -> Log.d("isPreferredCredentials", "ERROR: [${e}]") } </code></pre></li> </ol> <h3 id="thread_network_credentials_by_border_agent" data-text="Thread network credentials by Border Agent" tabindex="-1">Thread network credentials by Border Agent</h3> <p>A Border Agent ID uniquely identifies a border router device. To use the <code translate="no" dir="ltr">getCredentialsByBorderAgent</code> API, first you'll need to create a <code translate="no" dir="ltr">ThreadBorderAgent</code> object and pass the Border Agent ID.</p> <p>Once you've created the <code translate="no" dir="ltr">ThreadBorderAgent</code> object, call <code translate="no" dir="ltr">getCredentialsByBorderAgent</code>. If the credentials have been saved, check to see if they're preferred.</p> <aside class="special"><strong>Important:</strong><span> This API will fail if the credentials were not added by your app.</span></aside><pre class="prettyprint" translate="no" dir="ltr"><code translate="no" dir="ltr">private fun isPreferredThreadNetworkByBorderAgent(borderAgentInfo: BorderAgentInfo) { val threadBorderAgent = ThreadBorderAgent.newBuilder(borderAgentInfo.borderAgentId).build() Log.d("debug", "border router id:" + threadBorderAgent.id) var isPreferred = IsPreferredCredentialsResult.PREFERRED_CREDENTIALS_NOT_FOUND var borderAgentCredentials: ThreadNetworkCredentials? val taskByBorderAgent = ThreadNetwork.getClient(this) taskByBorderAgent .getCredentialsByBorderAgent(threadBorderAgent) .addOnSuccessListener { result: ThreadNetworkCredentialsResult -> borderAgentCredentials = result.credentials result.credentials?.let { taskByBorderAgent.isPreferredCredentials(it).addOnSuccessListener { result -> isPreferred = result } } } .addOnFailureListener { e: Exception -> Log.d(TAG, "ERROR: [${e}]") } } </code></pre> <h3 id="thread_network_credentials_by_extended_pan_id" data-text="Thread network credentials by Extended Pan ID" tabindex="-1">Thread network credentials by Extended Pan ID</h3> <p>Similar to <code translate="no" dir="ltr">getPreferredCredentials</code>, you can also prompt the user for credentials from a border router's Extended Pan ID. The <code translate="no" dir="ltr">getCredentialsByExtendedPanId</code> returns an <code translate="no" dir="ltr">IntentSender</code>, and the Activity result contains a <code translate="no" dir="ltr">ThreadNetworkCredentials</code> object when the user approves.</p> <pre class="prettyprint" translate="no" dir="ltr"><code translate="no" dir="ltr">private fun getCredentialsByExtPanId(borderAgentInfo: BorderAgentInfo) { ThreadNetwork.getClient(this) .getCredentialsByExtendedPanId(borderAgentInfo.extPanId) .addOnSuccessListener { intentSenderResult -> intentSenderResult.intentSender?.let { preferredCredentialsLauncher.launch(IntentSenderRequest.Builder(it).build()) } ?: Log.d("debug", "No credentials found.") } .addOnFailureListener { e: Exception -> Log.d(TAG, "ERROR: [${e}]") } } </code></pre> <h2 id="remove_credentials" data-text="Remove Credentials" tabindex="-1">Remove Credentials</h2> <p>When your Border Router device is removed from your home or factory reset, you need to remove its Thread network from Google Play services.</p> <pre class="prettyprint" translate="no" dir="ltr"><code translate="no" dir="ltr">private fun removeCredentials(borderAgentInfo: BorderAgentInfo) { val threadBorderAgent = ThreadBorderAgent.newBuilder(borderAgentInfo.borderAgentId).build() Log.d("debug", "border router id:" + threadBorderAgent.id) ThreadNetwork.getClient(this) .removeCredentials(threadBorderAgent) .addOnSuccessListener { Log.d("debug", "Credentials removed.") } .addOnFailureListener { e: Exception -> Log.d(TAG, "ERROR: [${e}]") } } </code></pre> <h2 id="resources" data-text="Resources" tabindex="-1">Resources</h2> <p>To learn more about the Thread Network SDK, refer to the <a href="/reference/com/google/android/gms/threadnetwork/package-summary">API Reference</a>.</p> </div> <div class="devsite-floating-action-buttons"> </div> </article> <devsite-content-footer class="nocontent"> <p>Except as otherwise noted, the content of this page is licensed under the <a href="https://creativecommons.org/licenses/by/4.0/">Creative Commons Attribution 4.0 License</a>, and code samples are licensed under the <a href="https://www.apache.org/licenses/LICENSE-2.0">Apache 2.0 License</a>. For details, see the <a href="https://developers.google.com/site-policies">Google Developers Site Policies</a>. Java is a registered trademark of Oracle and/or its affiliates.</p> <p>Last updated 2022-10-13 UTC.</p> </devsite-content-footer> <devsite-notification > </devsite-notification> <div class="devsite-content-data"> <template class="devsite-content-data-template"> [[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Incorrect information","incorrectInformation","thumb-down"],["Not enough information/samples","notEnoughInformationSamples","thumb-down"],["Too complicated","tooComplicated","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2022-10-13 UTC."],[],[]] </template> </div> </devsite-content> </main> <devsite-footer-promos class="devsite-footer"> </devsite-footer-promos> <devsite-footer-linkboxes class="devsite-footer"> <nav class="devsite-footer-linkboxes nocontent" aria-label="Footer links"> <ul class="devsite-footer-linkboxes-list"> <li class="devsite-footer-linkbox "> <h3 class="devsite-footer-linkbox-heading no-link">For devices</h3> <ul class="devsite-footer-linkbox-list"> <li class="devsite-footer-linkbox-item"> <a href="/matter" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Matter"data-category="Footer"> Matter </a> <div class="devsite-footer-linkbox-description">New IP-based smart home connectivity protocol that enables broad interoperability with many ecosystems</div> </li> <li class="devsite-footer-linkbox-item"> <a href="/device-sdk" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Device SDK"data-category="Footer"> Google Home Device SDK </a> <div class="devsite-footer-linkbox-description">Quickly build Matter devices, integrate with Google Home and access Google’s intelligence signals</div> </li> <li class="devsite-footer-linkbox-item"> <a href="/cloud-to-cloud" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-category="Footer"data-label="Cloud-to-cloud"> Cloud-to-cloud </a> <div class="devsite-footer-linkbox-description">Connect your cloud backend with the Smart Home API</div> </li> <li class="devsite-footer-linkbox-item"> <a href="/local-home" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-category="Footer"data-label="Local Home SDK"> Local Home SDK </a> <div class="devsite-footer-linkbox-description">Enhance your smart home integration with Google Assistant by adding a local fulfillment path to route smart home intents</div> </li> <li class="devsite-footer-linkbox-item"> <a href="/ways-to-build" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-category="Footer"data-label="Ways to Build"> <div class="devsite-footer-linkbox-icon" aria-hidden="true"> <picture> <img src="/images/footer-icon.svg" loading="lazy" alt=""> </picture> </div> Find out which integration to build </a> <div class="devsite-footer-linkbox-description">We’ll recommend an integration based on your device and needs</div> </li> </ul> </li> <li class="devsite-footer-linkbox "> <h3 class="devsite-footer-linkbox-heading no-link">For apps, platforms & services</h3> <ul class="devsite-footer-linkbox-list"> <li class="devsite-footer-linkbox-item"> <a href="/mobile-sdk" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Mobile SDK"data-category="Footer"> Google Home Mobile SDK </a> <div class="devsite-footer-linkbox-description">Speed up your Android mobile app development with Google Play services APIs for Matter devices</div> </li> <li class="devsite-footer-linkbox-item"> <a href="/app-discovery" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" target="_blank"data-category="Footer"data-label="App Discovery"> App Discovery </a> <div class="devsite-footer-linkbox-description">Shows a link to your app in the Google Home app to streamline account linking</div> </li> <li class="devsite-footer-linkbox-item"> <a href="/app-flip" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-category="Footer"data-label="App Flip"target="_blank"> App Flip </a> <div class="devsite-footer-linkbox-description">Enable quick, passwordless account linking</div> </li> <li class="devsite-footer-linkbox-item"> <a href="/cast" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" target="_blank"data-category="Footer"data-label="Cast SDK"> Google Cast SDK </a> <div class="devsite-footer-linkbox-description">Turn your app into a remote control and stream audio/video to a Cast-enabled device</div> </li> <li class="devsite-footer-linkbox-item"> <a href="/device-access" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-category="Footer"data-label="Device Access"target="_blank"> Device Access </a> <div class="devsite-footer-linkbox-description">Manage and control Nest devices in your smart home solution</div> </li> </ul> </li> <li class="devsite-footer-linkbox "> <h3 class="devsite-footer-linkbox-heading no-link">Use cases</h3> <ul class="devsite-footer-linkbox-list"> <li class="devsite-footer-linkbox-item"> <a href="/use-cases?device=light" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-category="Footer"data-label="Use Cases Lighting"> Lighting </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/use-cases?device=thermostat" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Use Cases Climate"data-category="Footer"> Climate </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/use-cases?device=lock" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Use Cases Safety"data-category="Footer"> Safety & security </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/use-cases?device=tv" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Use Cases Media"data-category="Footer"> Media & technology </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/use-cases?device=vacuum" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Use Cases Household"data-category="Footer"> Household appliances </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/use-cases?device=coffee-maker" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-category="Footer"data-label="Use Cases Kitchen"> Kitchen appliances </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/use-cases?device=shower" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Use Cases Bed"data-category="Footer"> Bed & bath </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/use-cases?device=sprinkler" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Use Cases Outdoor"data-category="Footer"> Outdoor </a> </li> </ul> </li> <li class="devsite-footer-linkbox "> <h3 class="devsite-footer-linkbox-heading no-link">Business resources</h3> <ul class="devsite-footer-linkbox-list"> <li class="devsite-footer-linkbox-item"> <a href="/certification" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Resources Certification"data-category="Footer"> Certification & badging </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/business-resources#marketing-resources" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Resources Marketing"data-category="Footer"> Marketing resources </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/business-resources#development-resources" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-label="Resources Development"data-category="Footer"> Development resources </a> </li> <li class="devsite-footer-linkbox-item"> <h3 class="devsite-footer-linkbox-heading no-link"> Terms & policies </h3> </li> <li class="devsite-footer-linkbox-item"> <a href="/terms" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-category="Footer"data-label="Terms"> Developer Terms of Service </a> </li> <li class="devsite-footer-linkbox-item"> <a href="/policies" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-category="Footer"data-label="Policies"> Developer Policies </a> </li> </ul> </li> <li class="devsite-footer-linkbox "> <h3 class="devsite-footer-linkbox-heading no-link">Docs & consoles</h3> <ul class="devsite-footer-linkbox-list"> <li class="devsite-footer-linkbox-item"> <a href="/docs" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-category="Footer"data-label="Docs"> Docs </a> </li> <li class="devsite-footer-linkbox-item"> <a href="//console.home.google.com" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" target="_blank"data-category="Footer"data-label="Console Home"> Google Home console </a> </li> <li class="devsite-footer-linkbox-item"> <a href="//console.actions.google.com" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" target="_blank"data-category="Footer"data-label="Console Actions"> Actions on Google console </a> </li> <li class="devsite-footer-linkbox-item"> <a href="//cast.google.com/publish" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-category="Footer"data-label="Console Cast"target="_blank"> Cast SDK console </a> </li> <li class="devsite-footer-linkbox-item"> <a href="//console.nest.google.com/device-access" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" target="_blank"data-category="Footer"data-label="Console Device Access"> Device Access console </a> </li> <li class="devsite-footer-linkbox-item"> <h3 class="devsite-footer-linkbox-heading no-link"> Communities </h3> </li> <li class="devsite-footer-linkbox-item"> <a href="//stackoverflow.com/questions/tagged/google-smart-home" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" data-category="Footer"data-label="Community Stack Overflow"target="_blank"> Stack Overflow </a> </li> <li class="devsite-footer-linkbox-item"> <a href="//www.googlenestcommunity.com/t5/Smart-Home-Developer-Forum/bd-p/Smart-Home-Developer-Forum" class="devsite-footer-linkbox-link gc-analytics-event" data-category="Site-Wide Custom Events" target="_blank"data-category="Footer"data-label="Community Google Nest"> Google Nest Community </a> </li> </ul> </li> </ul> </nav> </devsite-footer-linkboxes> <devsite-footer-utility class="devsite-footer"> <div class="devsite-footer-utility nocontent"> <nav class="devsite-footer-utility-links" aria-label="Utility links"> <ul class="devsite-footer-utility-list"> <li class="devsite-footer-utility-item "> <a class="devsite-footer-utility-link gc-analytics-event" href="//policies.google.com/terms" data-category="Site-Wide Custom Events" data-label="Footer Terms link" > Terms </a> </li> <li class="devsite-footer-utility-item "> <a class="devsite-footer-utility-link gc-analytics-event" href="//policies.google.com/privacy" data-category="Site-Wide Custom Events" data-label="Footer Privacy link" > Privacy </a> </li> <li class="devsite-footer-utility-item glue-cookie-notification-bar-control"> <a class="devsite-footer-utility-link gc-analytics-event" href="#" data-category="Site-Wide Custom Events" data-label="Footer Manage cookies link" aria-hidden="true" > Manage cookies </a> </li> </ul> <devsite-language-selector> <ul role="presentation"> <li role="presentation"> <a role="menuitem" lang="en" >English</a> </li> <li role="presentation"> <a role="menuitem" lang="de" >Deutsch</a> </li> <li role="presentation"> <a role="menuitem" lang="es" >Español</a> </li> <li role="presentation"> <a role="menuitem" lang="fr" >Français</a> </li> <li role="presentation"> <a role="menuitem" lang="id" >Indonesia</a> </li> <li role="presentation"> <a role="menuitem" lang="it" >Italiano</a> </li> <li role="presentation"> <a role="menuitem" lang="pl" >Polski</a> </li> <li role="presentation"> <a role="menuitem" lang="pt" >Português</a> </li> <li role="presentation"> <a role="menuitem" lang="vi" >Tiếng Việt</a> </li> <li role="presentation"> <a role="menuitem" lang="tr" >Türkçe</a> </li> <li role="presentation"> <a role="menuitem" lang="ru" >Русский</a> </li> <li role="presentation"> <a role="menuitem" lang="he" >עברית</a> </li> <li role="presentation"> <a role="menuitem" lang="ar" >العربيّة</a> </li> <li role="presentation"> <a role="menuitem" lang="fa" >فارسی</a> </li> <li role="presentation"> <a role="menuitem" lang="hi" >हिंदी</a> </li> <li role="presentation"> <a role="menuitem" lang="bn" >বাংলা</a> </li> <li role="presentation"> <a role="menuitem" lang="th" >ภาษาไทย</a> </li> <li role="presentation"> <a role="menuitem" lang="zh_cn" >中文 – 简体</a> </li> <li role="presentation"> <a role="menuitem" lang="zh_tw" >中文 – 繁體</a> </li> <li role="presentation"> <a role="menuitem" lang="ja" >日本語</a> </li> <li role="presentation"> <a role="menuitem" lang="ko" >한국어</a> </li> </ul> </devsite-language-selector> </nav> </div> </devsite-footer-utility> <devsite-panel></devsite-panel> </section></section> <devsite-sitemask></devsite-sitemask> <devsite-snackbar></devsite-snackbar> <devsite-tooltip ></devsite-tooltip> <devsite-heading-link></devsite-heading-link> <devsite-analytics> <script type="application/json" analytics>[{"dimensions": {"dimension2": false, "dimension5": false, "dimension4": "en", "dimension1": "Signed out", "dimension3": "en"}, "gaid": "UA-227286873-1", "metrics": {}, "purpose": 0}]</script> <script type="application/json" tag-management>{"at": "True", "ga4": [{"id": "G-333MC3Y0E5", "purpose": 0}], "ga4p": [{"id": "G-333MC3Y0E5", "purpose": 0}], "gtm": [], "parameters": {"internalUser": "False", "language": {"machineTranslated": "False", "requested": "en", "served": "en"}, "pageType": "article", "projectName": "Thread", "signedIn": "False", "tenant": "home", "recommendations": {"sourcePage": "", "sourceType": 0, "sourceRank": 0, "sourceIdenticalDescriptions": 0, "sourceTitleWords": 0, "sourceDescriptionWords": 0, "experiment": ""}, "experiment": {"ids": ""}}}</script> </devsite-analytics> <devsite-badger></devsite-badger> <devsite-fully-clickable target=" .home-core-clickable, .home-illustrated-items-program, .home-logos .devsite-landing-row-item, .home-sidecar-clickable, .home-sidecar-columns .devsite-landing-row-item, .fully-clickable" watch="devsite-content"></devsite-fully-clickable> <script nonce="rpnVic1RX14t7ixDSFc9IVAyI4bqbN"> (function(d,e,v,s,i,t,E){d['GoogleDevelopersObject']=i; t=e.createElement(v);t.async=1;t.src=s;E=e.getElementsByTagName(v)[0]; E.parentNode.insertBefore(t,E);})(window, document, 'script', 'https://www.gstatic.com/devrel-devsite/prod/v870e399c64f7c43c99a3043db4b3a74327bb93d0914e84a0c3dba90bbfd67625/home/js/app_loader.js', '[46,"en",null,"/js/devsite_app_module.js","https://www.gstatic.com/devrel-devsite/prod/v870e399c64f7c43c99a3043db4b3a74327bb93d0914e84a0c3dba90bbfd67625","https://www.gstatic.com/devrel-devsite/prod/v870e399c64f7c43c99a3043db4b3a74327bb93d0914e84a0c3dba90bbfd67625/home","https://home-dot-devsite-v2-prod.appspot.com",1,null,["/_pwa/home/manifest.json","https://www.gstatic.com/devrel-devsite/prod/v870e399c64f7c43c99a3043db4b3a74327bb93d0914e84a0c3dba90bbfd67625/images/video-placeholder.svg","https://www.gstatic.com/devrel-devsite/prod/v870e399c64f7c43c99a3043db4b3a74327bb93d0914e84a0c3dba90bbfd67625/home/images/favicon.png","https://www.gstatic.com/devrel-devsite/prod/v870e399c64f7c43c99a3043db4b3a74327bb93d0914e84a0c3dba90bbfd67625/home/images/lockup.svg","https://fonts.googleapis.com/css?family=Google+Sans:400,500|Roboto:400,400italic,500,500italic,700,700italic|Roboto+Mono:400,500,700&display=swap"],1,null,[1,6,8,12,14,17,21,25,50,52,63,70,75,76,80,87,91,92,93,97,98,100,101,102,103,104,105,107,108,109,110,112,113,116,117,118,120,122,124,125,126,127,129,130,131,132,133,134,135,136,138,140,141,147,148,149,151,152,156,157,158,159,161,163,164,168,169,170,179,180,182,183,186,191,193,196],"AIzaSyAP-jjEJBzmIyKR4F-3XITp8yM9T1gEEI8","AIzaSyB6xiKGDR5O3Ak2okS4rLkauxGUG7XP0hg","developers.home.google.com","AIzaSyAQk0fBONSGUqCNznf6Krs82Ap1-NV6J4o","AIzaSyCCxcqdrZ_7QMeLCRY20bh_SXdAYqy70KY",null,null,null,["Search__enable_page_map","Profiles__require_profile_eligibility_for_signin","Profiles__enable_public_developer_profiles","Profiles__enable_dashboard_curated_recommendations","Profiles__enable_release_notes_notifications","Cloud__enable_cloudx_ping","CloudShell__cloud_shell_button","Profiles__enable_developer_profiles_callout","DevPro__enable_developer_subscriptions","MiscFeatureFlags__enable_firebase_utm","MiscFeatureFlags__enable_explain_this_code","TpcFeatures__enable_required_headers","Profiles__enable_completecodelab_endpoint","BookNav__enable_tenant_cache_key","Profiles__enable_profile_collections","Cloud__enable_llm_concierge_chat","Search__enable_suggestions_from_borg","MiscFeatureFlags__emergency_css","MiscFeatureFlags__developers_footer_dark_image","Concierge__enable_pushui","EngEduTelemetry__enable_engedu_telemetry","Cloud__enable_cloud_dlp_service","Cloud__enable_legacy_calculator_redirect","OnSwitch__enable","Cloud__enable_cloud_shell","Profiles__enable_page_saving","CloudShell__cloud_code_overflow_menu","Cloud__enable_cloud_facet_chat","Search__enable_ai_eligibility_checks","Cloud__enable_free_trial_server_call","Experiments__reqs_query_experiments","DevPro__enable_cloud_innovators_plus","MiscFeatureFlags__enable_view_transitions","Cloud__enable_cloud_shell_fte_user_flow","MiscFeatureFlags__developers_footer_image","MiscFeatureFlags__enable_project_variables","Analytics__enable_clearcut_logging","Cloud__enable_cloudx_experiment_ids","Profiles__enable_awarding_url","TpcFeatures__enable_mirror_tenant_redirects","Profiles__enable_complete_playlist_endpoint","MiscFeatureFlags__enable_variable_operator","Profiles__enable_recognition_badges","Search__enable_dynamic_content_confidential_banner"],null,null,"AIzaSyBLEMok-5suZ67qRPzx0qUtbnLmyT_kCVE","https://developerscontentserving-pa.clients6.google.com","AIzaSyCM4QpTRSqP5qI4Dvjt4OAScIN8sOUlO-k","https://developerscontentsearch-pa.clients6.google.com",1,4,null,"https://developerprofiles-pa.clients6.google.com",[46,"home","Google Home Developers","developers.home.google.com",null,"home-dot-devsite-v2-prod.appspot.com",null,null,[null,1,null,null,null,null,null,null,null,null,null,[1],null,null,null,null,null,null,[1],null,null,null,null,[1,null,1],[1,1,null,1,1]],null,[61,null,null,null,null,null,"/images/lockup.svg","/images/touchicon-180.png",null,null,null,1,1,null,null,null,null,null,null,[[],[],[],[],[],[],[]],null,null,null,null,null,null,[]],[],null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,[2,4,6,7,1,12,14,15,17,18,20,21,22,23,28,30,32,36,39,40,43],null,[[],[1,1]],[[["UA-227286873-1"],["UA-227286873-2"],null,null,["UA-227286873-3"],null,null,[["G-333MC3Y0E5"],null,null,[["G-333MC3Y0E5",1]]],[["UA-227286873-1",1]],null,[["UA-227286873-3",1]],null,1],[[1,1],[5,8],[3,4],[2,2],[4,5]]],null,4],null,"pk_live_5170syrHvgGVmSx9sBrnWtA5luvk9BwnVcvIi7HizpwauFG96WedXsuXh790rtij9AmGllqPtMLfhe2RSwD6Pn38V00uBCydV4m"]') </script> <devsite-a11y-announce></devsite-a11y-announce> </body> </html>