AI-generated Key Takeaways
- 
          CapabilityClient exposes an API to learn about capabilities provided by nodes on the Wear network, which are local to an application. 
- 
          You can add or remove listeners to be notified of changes in capabilities on the Wear network. 
- 
          The client allows announcing when a capability becomes available or is no longer available on the local node. 
- 
          You can retrieve information about a specific capability or all capabilities, including the nodes that declare them, with options to filter by reachability. 
Exposes an API to learn about capabilities provided by nodes on the Wear network.
Capabilities are local to an application.
Nested Class Summary
| @interface | CapabilityClient.CapabilityFilterType | Capability filter types. | |
| @interface | CapabilityClient.NodeFilterType | Node filter types. | |
| interface | CapabilityClient.OnCapabilityChangedListener | Listener for changes in the reachable nodes providing a capability. | |
Constant Summary
| String | ACTION_CAPABILITY_CHANGED | Capability changed action for use in manifest-based listener filters. | 
| int | FILTER_ALL | Filter type for 
              getCapability(String, int),
              getAllCapabilities(int): If this filter is set then the full set of nodes
              that declare the given capability will be included in the capability'sCapabilityInfo. | 
| int | FILTER_LITERAL | Filter type for 
              addListener(OnCapabilityChangedListener, Uri, int): if this filter is set,
              the given URI will be taken as a literal path, and the operation will apply to the
              matching capability only. | 
| int | FILTER_PREFIX | Filter type for 
              addListener(OnCapabilityChangedListener, Uri, int): if this filter is set,
              the given URI will be taken as a path prefix, and the operation will apply to all
              matching capabilities. | 
| int | FILTER_REACHABLE | Filter type for 
              getCapability(String, int),
              getAllCapabilities(int): If this filter is set then only reachable nodes
              that declare the given capability will be included in the capability'sCapabilityInfo. | 
Public Method Summary
| abstract Task<Void> | 
                  
                  addListener(CapabilityClient.OnCapabilityChangedListener
                  listener, String capability)
                   
                    Registers a listener to be notified of a specific capability being added to or
                    removed from the Wear network.
                   | 
| abstract Task<Void> | 
                  
                  addListener(CapabilityClient.OnCapabilityChangedListener
                  listener, Uri uri, int
                  filterType)
                   
                    Registers a listener to be notified of capabilities being added to or removed
                    from the Wear network.
                   | 
| abstract Task<Void> | 
                  
                  addLocalCapability(String capability)
                   
                    Announces that a capability has become available on the local node.
                   | 
| abstract Task<Map<String, CapabilityInfo>> | 
                  
                  getAllCapabilities(int nodeFilter)
                   
                    Returns information about all capabilities, including the nodes that declare
                    those capabilities.
                   | 
| abstract Task<CapabilityInfo> | 
                  
                  getCapability(String capability,
                  int nodeFilter)
                   
                    Returns information about a capability, including the nodes that declare that
                    capability.
                   | 
| abstract Task<Boolean> | 
                  
                  removeListener(CapabilityClient.OnCapabilityChangedListener
                  listener)
                   
                    Removes a listener which was previously added through  
                    addListener(OnCapabilityChangedListener, Uri, int). | 
| abstract Task<Boolean> | 
                  
                  removeListener(CapabilityClient.OnCapabilityChangedListener
                  listener, String capability)
                   
                    Removes a listener which was previously added through  
                    addListener(OnCapabilityChangedListener, String). | 
| abstract Task<Void> | 
                  
                  removeLocalCapability(String capability)
                   
                    Announces that a capability is no longer available on the local node.
                   | 
Inherited Method Summary
Constants
public static final String ACTION_CAPABILITY_CHANGED
Capability changed action for use in manifest-based listener filters.
Capability events do not support filtering by host, but can be filtered by path.
See Also
public static final int FILTER_ALL
Filter type for 
            getCapability(String, int), 
            getAllCapabilities(int): If this filter is set then the full set of nodes
            that declare the given capability will be included in the capability's CapabilityInfo.
public static final int FILTER_LITERAL
Filter type for 
            addListener(OnCapabilityChangedListener, Uri, int): if this filter is set,
            the given URI will be taken as a literal path, and the operation will apply to the
            matching capability only.
public static final int FILTER_PREFIX
Filter type for 
            addListener(OnCapabilityChangedListener, Uri, int): if this filter is set,
            the given URI will be taken as a path prefix, and the operation will apply to all
            matching capabilities.
public static final int FILTER_REACHABLE
Filter type for 
            getCapability(String, int), 
            getAllCapabilities(int): If this filter is set then only reachable nodes
            that declare the given capability will be included in the capability's CapabilityInfo.
Public Methods
public abstract Task<Void> addListener (CapabilityClient.OnCapabilityChangedListener listener, String capability)
Registers a listener to be notified of a specific capability being added to or
            removed from the Wear network. Calls to this method should be balanced with
            
            removeListener(OnCapabilityChangedListener, String) to avoid leaking
            resources.
Listeners will be called on the main thread, or the looper set in Wearable.WearableOptions.
Callers wishing to be notified of events in the background should use WearableListenerService.
public abstract Task<Void> addListener (CapabilityClient.OnCapabilityChangedListener listener, Uri uri, int filterType)
Registers a listener to be notified of capabilities being added to or removed from
            the Wear network. Calls to this method should be balanced with 
            removeListener(OnCapabilityChangedListener) to avoid leaking resources.
uri and filterType can be used to filter the capability
            changes sent to the listener. For example, if uri and
            filterType create a prefix filter, then only capabilities matching that
            prefix will be notified. The uri follows the rules of the <data>
            element of <intent-filter>. The path is ignored if a URI host is not specified.
            To match capabilities by name or name prefix, the host must be *.
            For example:
wear://*/<capability_name>
Listeners will be called on the main thread, or the looper set in Wearable.WearableOptions.
Callers wishing to be notified of events in the background should use WearableListenerService.
public abstract Task<Void> addLocalCapability (String capability)
Announces that a capability has become available on the local node.
public abstract Task<Map<String, CapabilityInfo>> getAllCapabilities (int nodeFilter)
Returns information about all capabilities, including the nodes that declare those
            capabilities. The filter parameter controls whether all nodes are returned,
            FILTER_ALL,
            or only those that are currently reachable by this node, 
            FILTER_REACHABLE.
The local node will never be returned in the set of nodes.
public abstract Task<CapabilityInfo> getCapability (String capability, int nodeFilter)
Returns information about a capability, including the nodes that declare that
            capability. The filter parameter controls whether all nodes are returned,
            
            FILTER_ALL, or only those that are currently reachable by this node,
            
            FILTER_REACHABLE.
The local node will never be returned in the set of nodes.
public abstract Task<Boolean> removeListener (CapabilityClient.OnCapabilityChangedListener listener)
Removes a listener which was previously added through 
            addListener(OnCapabilityChangedListener, Uri, int). The listener will
            continue to receive events for capabilities it was previously registered for with
            
            addListener(OnCapabilityChangedListener, String), until those instances are
            removed.
public abstract Task<Boolean> removeListener (CapabilityClient.OnCapabilityChangedListener listener, String capability)
Removes a listener which was previously added through 
            addListener(OnCapabilityChangedListener, String). The listener is only
            removed from listening for the capability provided. All other instances of this
            listener will continue to receive events until they are also removed.