Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Detect when wearable connected/disconnected to/from Android phone

Tags:

android

events

The Pebble watch has a Intent that is globally sended when the Pebble is connected/disconnected. This allow the phone apps to know if the watch is connected or not. I have searched but I'm not capable to locate info about a similar feature for Android Wear. How know if a wearable is connected to the phone? Is possible to receive a event like with Pebble? Thanks

like image 802
The Matrix Avatar asked Sep 02 '14 08:09

The Matrix


1 Answers

Have you tried NodeApi, you can use getConnectedNodes

Gets a list of Nodes to which this device is currently connected.

or addListener(GoogleApiClient client, NodeApi.NodeListener listener) which

Registers a listener to receive all node events.

Then you can use callbacks from NodeApi.NodeListener

onPeerConnected(Node peer) and onPeerDisconnected(Node peer)
like image 66
akmal Avatar answered Sep 30 '22 16:09

akmal