CapabilityApi Stay organized with collections Save and categorize content based on your preferences.
Page Summary
This interface is deprecated and
CapabilityClientshould be used instead.The CapabilityApi exposes an API to learn about capabilities provided by nodes on the Wear network.
Capabilities are local to an application.
It includes methods to add and remove local capabilities and listeners for capability changes.
This interface is deprecated.
UseCapabilityClient.
Exposes an API to learn about capabilities provided by nodes on the Wear network.
Capabilities are local to an application.
Nested Class Summary
| interface | CapabilityApi.AddLocalCapabilityResult | This interface is deprecated. See CapabilityClient.addLocalCapability(String). | |
| @interface | CapabilityApi.CapabilityFilterType | ||
| interface | CapabilityApi.CapabilityListener | This interface is deprecated. Use CapabilityClient.OnCapabilityChangedListener. | |
| interface | CapabilityApi.GetAllCapabilitiesResult | This interface is deprecated. See CapabilityClient.getAllCapabilities(int). | |
| interface | CapabilityApi.GetCapabilityResult | This interface is deprecated. See CapabilityClient.getCapability(String, int). | |
| @interface | CapabilityApi.NodeFilterType | ||
| interface | CapabilityApi.RemoveLocalCapabilityResult | This interface is deprecated. See CapabilityClient.removeLocalCapability(String). | |
Constant Summary
| String | ACTION_CAPABILITY_CHANGED | Capability changed action for use in manifest-based listener filters. |
| int | FILTER_ALL | Filter type for getCapability(GoogleApiClient, String, int), getAllCapabilities(GoogleApiClient, 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(GoogleApiClient, CapabilityListener, 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(GoogleApiClient, CapabilityListener, 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(GoogleApiClient, String, int), getAllCapabilities(GoogleApiClient, 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
| abstractPendingResult<Status> | addCapabilityListener(GoogleApiClient client, CapabilityApi.CapabilityListener listener,String capability) Registers a listener to be notified of a specific capability being added to or removed from the Wear network. |
| abstractPendingResult<Status> | addListener(GoogleApiClient client, CapabilityApi.CapabilityListener listener,Uri uri, int filterType) Registers a listener to be notified of capabilities being added to or removed from the Wear network. |
| abstractPendingResult<CapabilityApi.AddLocalCapabilityResult> | addLocalCapability(GoogleApiClient client,String capability) Announces that a capability has become available on the local node. |
| abstractPendingResult<CapabilityApi.GetAllCapabilitiesResult> | getAllCapabilities(GoogleApiClient client, int nodeFilter) Returns information about all capabilities, including the nodes that declare those capabilities. |
| abstractPendingResult<CapabilityApi.GetCapabilityResult> | getCapability(GoogleApiClient client,String capability, int nodeFilter) Returns information about a capability, including the nodes that declare that capability. |
| abstractPendingResult<Status> | removeCapabilityListener(GoogleApiClient client, CapabilityApi.CapabilityListener listener,String capability) Removes a listener which was previously added through addCapabilityListener(GoogleApiClient, CapabilityApi.CapabilityListener, String). |
| abstractPendingResult<Status> | removeListener(GoogleApiClient client, CapabilityApi.CapabilityListener listener) Removes a listener which was previously added through addListener(GoogleApiClient, CapabilityApi.CapabilityListener, Uri, int). |
| abstractPendingResult<CapabilityApi.RemoveLocalCapabilityResult> | removeLocalCapability(GoogleApiClient client,String capability) Announces that a capability is no longer available on the local node. |
Constants
public static finalStringACTION_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 intFILTER_ALL
Filter type for getCapability(GoogleApiClient, String, int), getAllCapabilities(GoogleApiClient, int): If this filter is set then the full set of nodes that declare the given capability will be included in the capability'sCapabilityInfo.
public static final intFILTER_LITERAL
Filter type for addListener(GoogleApiClient, CapabilityListener, 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 intFILTER_PREFIX
Filter type for addListener(GoogleApiClient, CapabilityListener, 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 intFILTER_REACHABLE
Filter type for getCapability(GoogleApiClient, String, int), getAllCapabilities(GoogleApiClient, int): If this filter is set then only reachable nodes that declare the given capability will be included in the capability'sCapabilityInfo.
Public Methods
public abstractPendingResult<Status>addCapabilityListener(GoogleApiClient client,CapabilityApi.CapabilityListener 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 removeCapabilityListener(GoogleApiClient, CapabilityApi.CapabilityListener, String) to avoid leaking resources.
Listener events will be called on the main thread, or the handler specified onclient when it was built (using GoogleApiClient.Builder.setHandler(Handler)).
Callers wishing to be notified of events in the background should useWearableListenerService.
public abstractPendingResult<Status>addListener(GoogleApiClient client,CapabilityApi.CapabilityListener 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(GoogleApiClient, CapabilityApi.CapabilityListener) to avoid leaking resources.
uri andfilterType can be used to filter the capability changes sent to the listener. For example, ifuri andfilterType create a prefix filter, then only capabilities matching that prefix will be notified. Theuri 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 hostmust be*. For example:
wear://*/<capability_name>
Listener events will be called on the main thread, or the handler specified onclient when it was built (using GoogleApiClient.Builder.setHandler(Handler)).
Callers wishing to be notified of events in the background should useWearableListenerService.
public abstractPendingResult<CapabilityApi.AddLocalCapabilityResult>addLocalCapability(GoogleApiClient client,String capability)
Announces that a capability has become available on the local node.
public abstractPendingResult<CapabilityApi.GetAllCapabilitiesResult>getAllCapabilities(GoogleApiClient client, 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 abstractPendingResult<CapabilityApi.GetCapabilityResult>getCapability(GoogleApiClient client,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 abstractPendingResult<Status>removeCapabilityListener(GoogleApiClient client,CapabilityApi.CapabilityListener listener,String capability)
Removes a listener which was previously added through addCapabilityListener(GoogleApiClient, CapabilityApi.CapabilityListener, String). The listener is only removed from listening for the capability provided and will continue to receive messages for any other capabilities it was previously registered for that have not also been removed.
public abstractPendingResult<Status>removeListener(GoogleApiClient client,CapabilityApi.CapabilityListener listener)
Removes a listener which was previously added through addListener(GoogleApiClient, CapabilityApi.CapabilityListener, Uri, int). The listener is only removed from listening for the capability provided and will continue to receive messages for any other capabilities it was previously registered for that have not also been removed.
public abstractPendingResult<CapabilityApi.RemoveLocalCapabilityResult>removeLocalCapability(GoogleApiClient client,String capability)
Announces that a capability is no longer available on the local node. Note: this will not remove any capabilities announced in the Manifest for an app.
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-11-21 UTC.