com.google.android.gms.wearable.ChannelApi |
This interface is deprecated.
Use ChannelClient
.
Client interface for Wearable Channel API. Allows apps on a wearable device to send and receive data from other wearable nodes.
Channels are bidirectional. Each side, both the initiator and the receiver may both read and
write to the channel by using getOutputStream(GoogleApiClient)
and getInputStream(GoogleApiClient)
. Once a channel is established, the API for the
initiator and receiver are identical.
Channels are only available when the wearable nodes are connected. When the remote node
disconnects, all existing channels will be closed. Any listeners (added through addListener(GoogleApiClient, ChannelListener)
and any installed WearableListenerService
) will be notified of the channel closing.
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
ChannelApi.ChannelListener |
This interface is deprecated.
Use ChannelClient.ChannelCallback .
|
||||||||||
ChannelApi.CloseReason | An annotation for values passed to onChannelClosed(Channel, int, int) , and other methods
on the ChannelApi.ChannelListener interface. |
||||||||||
ChannelApi.OpenChannelResult |
This interface is deprecated.
See openChannel(String, String) .
|
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
String | ACTION_CHANNEL_EVENT | Channel action for use in listener filters. |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Registers a listener to be notified of channel events.
| |||||||||||
Opens a channel to exchange data with a remote node.
| |||||||||||
Removes a listener which was previously added through
addListener(GoogleApiClient, ChannelListener) . |
Channel action for use in listener filters.
See also:
Registers a listener to be notified of channel events. Calls to this method should be balanced
with calls to removeListener(GoogleApiClient, ChannelListener)
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 : a connected client |
listener |
ChannelApi.ChannelListener : a listener which will be notified of changes to any channel
|
Returns | |
---|---|
PendingResult<Status> |
Opens a channel to exchange data with a remote node.
Channel which are no longer needed should be closed using close(GoogleApiClient)
.
This call involves a network round trip, so may be long running. client
must remain
connected during that time, or the request will be cancelled (like any other Play Services API
calls).
Parameters | |
---|---|
client |
GoogleApiClient : a connected client |
nodeId |
String : the node ID of a wearable node, as returned from getConnectedNodes(GoogleApiClient) |
path |
String : an app-specific identifier for the channel
|
Returns | |
---|---|
PendingResult<ChannelApi.OpenChannelResult> |
Removes a listener which was previously added through addListener(GoogleApiClient, ChannelListener)
.
Parameters | |
---|---|
client |
GoogleApiClient : a connected client |
listener |
ChannelApi.ChannelListener : a listener which was added using addListener(GoogleApiClient, ChannelListener)
|
Returns | |
---|---|
PendingResult<Status> |