Summary: Constants | Methods | [Expand All]
public static interface

# ChannelApi.ChannelListener

com.google.android.gms.wearable.ChannelApi.ChannelListener

Known Indirect Subclasses WearableListenerService
WearableListenerService | Receives events from other nodes, such as data changes, messages or connectivity events.

## Class Overview

A listener which will be notified on changes to channels.

## Summary

Constants
int | CLOSE_REASON_DISCONNECTED | Value passed to `onChannelClosed(Channel, int, int)`, `onInputClosed(Channel, int, int)` and `onOutputClosed(Channel, int, int)` when the closing is due to a remote node being disconnected.
int | CLOSE_REASON_LOCAL_CLOSE | Value passed to `onChannelClosed(Channel, int, int)`, `onInputClosed(Channel, int, int)` and `onOutputClosed(Channel, int, int)` when the stream is closed due to the local node calling `close(GoogleApiClient)` or `close(GoogleApiClient, int)`.
int | CLOSE_REASON_NORMAL | Value passed to `onInputClosed(Channel, int, int)` or `onOutputClosed(Channel, int, int)` (but not `onChannelClosed(Channel, int, int)`), when the stream was closed under normal conditions, e.g the whole file was read, or the `OutputStream` on the remote node was closed normally.
int | CLOSE_REASON_REMOTE_CLOSE | Value passed to `onChannelClosed(Channel, int, int)`, `onInputClosed(Channel, int, int)` and `onOutputClosed(Channel, int, int)` when the stream is closed due to the remote node calling `close(GoogleApiClient)` or `close(GoogleApiClient, int)`.

Public Methods
abstract void | onChannelClosed(Channel channel, int closeReason, int appSpecificErrorCode) Called when a channel is closed.
abstract void | onChannelOpened(Channel channel) Called when a new channel is opened by a remote node.
abstract void | onInputClosed(Channel channel, int closeReason, int appSpecificErrorCode) Called when the input side of a channel is closed.
abstract void | onOutputClosed(Channel channel, int closeReason, int appSpecificErrorCode) Called when the output side of a channel is closed.

## Constants

#### public static final int CLOSE_REASON_DISCONNECTED

Value passed to `onChannelClosed(Channel, int, int)`, `onInputClosed(Channel, int, int)` and `onOutputClosed(Channel, int, int)` when the closing is due to a remote node being disconnected.

Constant Value: 1 (0x00000001)

#### public static final int CLOSE_REASON_LOCAL_CLOSE

Value passed to `onChannelClosed(Channel, int, int)`, `onInputClosed(Channel, int, int)` and `onOutputClosed(Channel, int, int)` when the stream is closed due to the local node calling `close(GoogleApiClient)` or `close(GoogleApiClient, int)`.

Constant Value: 3 (0x00000003)

#### public static final int CLOSE_REASON_NORMAL

Value passed to `onInputClosed(Channel, int, int)` or `onOutputClosed(Channel, int, int)` (but not `onChannelClosed(Channel, int, int)`), when the stream was closed under normal conditions, e.g the whole file was read, or the `OutputStream` on the remote node was closed normally.

Constant Value: 0 (0x00000000)

#### public static final int CLOSE_REASON_REMOTE_CLOSE

Value passed to `onChannelClosed(Channel, int, int)`, `onInputClosed(Channel, int, int)` and `onOutputClosed(Channel, int, int)` when the stream is closed due to the remote node calling `close(GoogleApiClient)` or `close(GoogleApiClient, int)`.

Constant Value: 2 (0x00000002)

## Public Methods

#### public abstract void onChannelClosed (Channel channel, int closeReason, int appSpecificErrorCode)

Called when a channel is closed. This can happen through an explicit call to `close(GoogleApiClient)` or `close(GoogleApiClient, int)` on either side of the connection, or due to disconnecting from the remote node.

##### Parameters

closeReason | the reason for the channel closing. One of `CLOSE_REASON_DISCONNECTED`, `CLOSE_REASON_REMOTE_CLOSE`, or `CLOSE_REASON_LOCAL_CLOSE`.
appSpecificErrorCode | the error code specified on `close(GoogleApiClient)`, or 0 if `closeReason` is `CLOSE_REASON_DISCONNECTED`.

#### public abstract void onChannelOpened (Channel channel)

Called when a new channel is opened by a remote node.

#### public abstract void onInputClosed (Channel channel, int closeReason, int appSpecificErrorCode)

Called when the input side of a channel is closed.

##### Parameters

closeReason | the reason for the input closing. One of `CLOSE_REASON_DISCONNECTED`, `CLOSE_REASON_REMOTE_CLOSE`, `CLOSE_REASON_LOCAL_CLOSE`, or `CLOSE_REASON_NORMAL`
appSpecificErrorCode | the error code specified on `close(GoogleApiClient)`, or 0 if `closeReason` is `CLOSE_REASON_DISCONNECTED` or `CLOSE_REASON_NORMAL`.

#### public abstract void onOutputClosed (Channel channel, int closeReason, int appSpecificErrorCode)

Called when the output side of a channel is closed.

##### Parameters

closeReason | the reason for the output closing. One of `CLOSE_REASON_DISCONNECTED`, `CLOSE_REASON_REMOTE_CLOSE`, `CLOSE_REASON_LOCAL_CLOSE`, or `CLOSE_REASON_NORMAL`
appSpecificErrorCode | the error code specified on `close(GoogleApiClient)`, or 0 if `closeReason` is `CLOSE_REASON_DISCONNECTED` or `CLOSE_REASON_NORMAL`.