Jon
Jon

Reputation: 1499

Android - Getting Android ID of Android Wearable Device from Smart Phone

Is there a way to get the Android ID of an Android Wearable device that pairs with my smart phone? I have my app running on the smart phone but no app running on the android wearable device (watch for example).

From my understanding, the Android Wearable device and the smart phone will pair via BlueTooth. I looked through all of the bluetooth APIs (http://developer.android.com/guide/topics/connectivity/bluetooth.html) and the closest thing I can get to an ID is the UUID which isn't the Android ID (http://developer.android.com/reference/android/bluetooth/BluetoothDevice.html#getUuids())

Thanks! J

Upvotes: 0

Views: 1257

Answers (1)

Blackbelt
Blackbelt

Reputation: 157437

it's possible. You need to use the NodeApi on the Handheld, to get the connected nodes, through getConnectedNodes. It returns an instance of NodeApi.GetConnectedNodesResult. Through this object you can retrieve the list of all the connected nodes. E.g

Wearable.NodeApi.getConnectedNodes(mGoogleApiClient).setResultCallback(new ResultCallback<NodeApi.GetConnectedNodesResult>() {
        @Override
        public void onResult(NodeApi.GetConnectedNodesResult getConnectedNodesResult) {
                for (Node node : getConnectedNodesResult.getNodes()) {
                   Log.i(LOG_TAG, "node id " + node.getId());
                }
         }
});  

Upvotes: 1

Related Questions