com.google.android.gms.wearable.CapabilityApi |
This interface is deprecated.
Use CapabilityClient
.
Exposes an API to learn about capabilities provided by nodes on the Wear network.
Capabilities are local to an application.
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
CapabilityApi.AddLocalCapabilityResult |
This interface is deprecated.
See addLocalCapability(String) .
|
||||||||||
CapabilityApi.CapabilityFilterType | |||||||||||
CapabilityApi.CapabilityListener |
This interface is deprecated.
Use CapabilityClient.OnCapabilityChangedListener .
|
||||||||||
CapabilityApi.GetAllCapabilitiesResult |
This interface is deprecated.
See getAllCapabilities(int) .
|
||||||||||
CapabilityApi.GetCapabilityResult |
This interface is deprecated.
See getCapability(String, int) .
|
||||||||||
CapabilityApi.NodeFilterType | |||||||||||
CapabilityApi.RemoveLocalCapabilityResult |
This interface is deprecated.
See removeLocalCapability(String) .
|
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
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's CapabilityInfo . |
|||||||||
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's CapabilityInfo . |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Registers a listener to be notified of a specific capability being added to or removed from the
Wear network.
| |||||||||||
Registers a listener to be notified of capabilities being added to or removed from the Wear
network.
| |||||||||||
Announces that a capability has become available on the local node.
| |||||||||||
Returns information about all capabilities, including the nodes that declare those
capabilities.
| |||||||||||
Returns information about a capability, including the nodes that declare that capability.
| |||||||||||
Removes a listener which was previously added through
addCapabilityListener(GoogleApiClient, CapabilityApi.CapabilityListener, String) . | |||||||||||
Removes a listener which was previously added through
addListener(GoogleApiClient, CapabilityApi.CapabilityListener, Uri, int) . | |||||||||||
Announces that a capability is no longer available on the local node.
|
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:
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's CapabilityInfo
.
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.
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.
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's CapabilityInfo
.
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 on client
when it was built (using setHandler(Handler)
).
Callers wishing to be notified of events in the background should use WearableListenerService
.
Parameters | |
---|---|
client |
GoogleApiClient |
listener |
CapabilityApi.CapabilityListener |
capability |
String |
Returns | |
---|---|
PendingResult<Status> |
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
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 *
. i.e:
wear://*/<capability_name>
Listener events will be called on the main thread, or the handler specified on client
when it was built (using setHandler(Handler)
).
Callers wishing to be notified of events in the background should use WearableListenerService
.
Parameters | |
---|---|
client |
GoogleApiClient |
listener |
CapabilityApi.CapabilityListener |
uri |
Uri |
filterType |
int |
Returns | |
---|---|
PendingResult<Status> |
Announces that a capability has become available on the local node.
Parameters | |
---|---|
client |
GoogleApiClient |
capability |
String |
Returns | |
---|---|
PendingResult<CapabilityApi.AddLocalCapabilityResult> |
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.
Parameters | |
---|---|
client |
GoogleApiClient |
nodeFilter |
int |
Returns | |
---|---|
PendingResult<CapabilityApi.GetAllCapabilitiesResult> |
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.
Parameters | |
---|---|
client |
GoogleApiClient |
capability |
String |
nodeFilter |
int |
Returns | |
---|---|
PendingResult<CapabilityApi.GetCapabilityResult> |
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.
Parameters | |
---|---|
client |
GoogleApiClient |
listener |
CapabilityApi.CapabilityListener |
capability |
String |
Returns | |
---|---|
PendingResult<Status> |
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.
Parameters | |
---|---|
client |
GoogleApiClient |
listener |
CapabilityApi.CapabilityListener |
Returns | |
---|---|
PendingResult<Status> |
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.
Parameters | |
---|---|
client |
GoogleApiClient |
capability |
String |
Returns | |
---|---|
PendingResult<CapabilityApi.RemoveLocalCapabilityResult> |