NodeApi

public interface NodeApi

Exposes an API for to learn about local or connected Nodes.

Node events are delivered to all applications on a device.

New code should use the CapabilityApi which allows you to create and listen to application-specific network events.

Nested Class Summary

interface NodeApi.GetConnectedNodesResult Contains a list of connected nodes. 
interface NodeApi.GetLocalNodeResult Contains the name and id that represents this device. 
interface NodeApi.NodeListener This interface was deprecated. New code should use the CapabilityApi which enables an app to advertise a capability on a node and listen for its existence on other nodes.  

Public Method Summary

abstract PendingResult<Status>
addListener(GoogleApiClient client, NodeApi.NodeListener listener)
This method was deprecated. New code should use the CapabilityApi which enables an app to advertise a capability on a node and listen for its existence on other nodes.
abstract PendingResult<NodeApi.GetConnectedNodesResult>
getConnectedNodes(GoogleApiClient client)
Gets a list of nodes to which this device is currently connected, either directly or indirectly via a directly connected node.
abstract PendingResult<NodeApi.GetLocalNodeResult>
getLocalNode(GoogleApiClient client)
Gets the Node that refers to this device.
abstract PendingResult<Status>
removeListener(GoogleApiClient client, NodeApi.NodeListener listener)
This method was deprecated. New code should use the CapabilityApi which enables an app to advertise a capability on a node and listen for its existence on other nodes.

Public Methods

public abstract PendingResult<Status> addListener (GoogleApiClient client, NodeApi.NodeListener listener)

This method was deprecated.
New code should use the CapabilityApi which enables an app to advertise a capability on a node and listen for its existence on other nodes.

Registers a listener to receive all node events. Calls to this method should be balanced with removeListener(GoogleApiClient, NodeListener), 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 node events in the background should use WearableListenerService.

public abstract PendingResult<NodeApi.GetConnectedNodesResult> getConnectedNodes (GoogleApiClient client)

Gets a list of nodes to which this device is currently connected, either directly or indirectly via a directly connected node.

The returned list will not include the {@linkplain #getLocalNode(GoogleApiClient) local node}.

public abstract PendingResult<NodeApi.GetLocalNodeResult> getLocalNode (GoogleApiClient client)

Gets the Node that refers to this device. The information in the returned Node can be passed to other devices using the MessageApi, for example.

public abstract PendingResult<Status> removeListener (GoogleApiClient client, NodeApi.NodeListener listener)

This method was deprecated.
New code should use the CapabilityApi which enables an app to advertise a capability on a node and listen for its existence on other nodes.

Removes a listener which was previously added through addListener(GoogleApiClient, NodeListener).