NodeApi | Android Developers

Quicknav Quicknav
Links

- Google Play Developer Console
- Android Developers Blog
- About Android

Android Sites

- Android.com
- Android Developers
- Android Open Source Project

Language
close

- - About
  - Wear
  - TV
  - Auto
- - Get Started
  - Devices
  - Style
  - Patterns
  - Building Blocks
  - Downloads
  - Videos
- - Training
  - API Guides
  - Reference
  - Tools
  - Google Services
  - Samples
- - Google Play
  - Essentials
  - Get Users
  - Engage & Retain
  - Monetize
  - Analyze
  - Tools & Reference
  - Developer Stories

## Results

Loading...
public interface

# NodeApi

com.google.android.gms.wearable.NodeApi

## Class Overview

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

Node events are delivered to all applications on a device.

## Summary

Nested Classes
interface | NodeApi.GetConnectedNodesResult | Contains a list of connected nodes.
interface | NodeApi.GetLocalNodeResult | Contains the name and id that represents this device.
interface | NodeApi.NodeListener | Used with `addListener(GoogleApiClient, NodeApi.NodeListener)` to receive node events.

Public Methods
abstract PendingResult<Status> | addListener(GoogleApiClient client, NodeApi.NodeListener listener) Registers a listener to receive all node events.
abstract PendingResult<NodeApi.GetConnectedNodesResult> | getConnectedNodes(GoogleApiClient client) Gets a list of nodes to which this device is currently connected.
abstract PendingResult<NodeApi.GetLocalNodeResult> | getLocalNode(GoogleApiClient client) Gets the `Node` that refers to this device.
abstract PendingResult<Status> | removeListener(GoogleApiClient client, NodeApi.NodeListener listener) Removes a listener which was previously added through `addListener(GoogleApiClient, NodeListener)`.

## Public Methods

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

Registers a listener to receive all node events. Calls to this method should balanced with `removeListener(GoogleApiClient, NodeListener)`, to avoid leaking resources.

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.

The returned list will not include the 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)

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