IMPORTANT: You must be part of the Matter Private Beta Program to start developing Matter devices and apps in the Google Home Developer Console. Apply now

ThreadNetworkClient

public interface ThreadNetworkClient implements HasApiKey<Api.ApiOptions.NoOptions>

A client for the Thread Network API.

Public Method Summary

abstract Task<Void>
addCredentials(ThreadBorderAgent borderAgent, ThreadNetworkCredentials credentials)
Adds the Thread network credentials to the secure storage.
abstract Task<List<ThreadNetworkCredentials>>
getAllCredentials()
Retrieves all Thread network credentials added by your app.
abstract Task<ThreadNetworkCredentialsResult>
getCredentialsByBorderAgent(ThreadBorderAgent borderAgent)
Retrieves Thread network credentials with given borderAgent.
abstract Task<IntentSenderResult>
getCredentialsByExtendedPanId(byte[] extendedPanId)
Retrieves Thread network credentials with given extendedPanId.
abstract Task<IntentSenderResult>
getPreferredCredentials()
Retrieves the preferred Thread network credentials from the secure storage.
abstract Task<Integer>
isPreferredCredentials(ThreadNetworkCredentials credentials)
Checks if the credentials represents the same Thread network as the preferred network.
abstract Task<Void>
removeCredentials(ThreadBorderAgent borderAgent)
Removes Thread network credentials of given borderAgent from the secure storage.

Public Methods

public abstract Task<Void> addCredentials (ThreadBorderAgent borderAgent, ThreadNetworkCredentials credentials)

Adds the Thread network credentials to the secure storage.

In case there are already Thread network credentials associated with the same borderAgent, the credentials will be overwritten if it was added by your app; otherwise, the returned Task will fail with a ApiException with status code ThreadNetworkStatusCodes.PERMISSION_DENIED.

public abstract Task<List<ThreadNetworkCredentials>> getAllCredentials ()

Retrieves all Thread network credentials added by your app.

public abstract Task<ThreadNetworkCredentialsResult> getCredentialsByBorderAgent (ThreadBorderAgent borderAgent)

Retrieves Thread network credentials with given borderAgent.

If the credentials are not added by your app, the returned Task will fail with ApiException with status code ThreadNetworkStatusCodes.PERMISSION_DENIED.

public abstract Task<IntentSenderResult> getCredentialsByExtendedPanId (byte[] extendedPanId)

Retrieves Thread network credentials with given extendedPanId.

For success cases, a IntentSender will be returned to pop up a consent dialog to ask the user for sharing the credentials and the credentials will be passed to the caller in ActivityResult if the user approves. In case there are no preferred network credentials, IntentSenderResult.getIntentSender() will return null.

public abstract Task<IntentSenderResult> getPreferredCredentials ()

Retrieves the preferred Thread network credentials from the secure storage.

Your app must be connected to a local Wi-Fi or Ethernet network. Otherwise, the returned Task will fail with ApiException with status code ThreadNetworkStatusCodes.LOCAL_NETWORK_NOT_CONNECTED. For success cases, a IntentSenderResult will be returned to pop up a consent dialog to ask the user for sharing the credentials and the credentials will be passed to the caller in ActivityResult if the user approves. In case there are no preferred network credentials, IntentSenderResult.getIntentSender() will return null.

public abstract Task<Integer> isPreferredCredentials (ThreadNetworkCredentials credentials)

Checks if the credentials represents the same Thread network as the preferred network.

The return value can be:

Typical usage of this API is to check if a active Thread Border Router is already in the preferred network before calling getPreferredCredentials() which can pop up a consent dialog.

public abstract Task<Void> removeCredentials (ThreadBorderAgent borderAgent)

Removes Thread network credentials of given borderAgent from the secure storage.

If the Thread network credentials were not added by your app, the returned Task will fail with a ApiException with status code ThreadNetworkStatusCodes.PERMISSION_DENIED.