I'm experimenting a bit with Android Wear (streaming data from the watch to the phone) and I was looking into the CapabilityApi.
According to the documentation for Wearable.CapabilityApi.getCapability there is no guarantee that this call will only return connected nodes: https://developers.google.com/android/reference/com/google/android/gms/wearable/CapabilityInfo.html#getNodes()
What I wonder is, do I have to do something like the following:
final CapabilityApi.GetCapabilityResult result =
Wearable.CapabilityApi.getCapability(mGoogleApiClient, RECIEVE_SOUND_DATA_CAPABILITY, Wearable.CapabilityApi.FILTER_REACHABLE).await();
final NodeApi.GetConnectedNodesResult connectedNodes = Wearable.NodeApi.getConnectedNodes(mGoogleApiClient).await();
for (final Node node : result.getCapability().getNodes()) {
if (connectedNodes.getNodes().contains(node)){
sendDataToNode(node, dataSender);
}
}
In order to determine that the node is actually connected, or is it enough to call:
node.isNearby()
Prior to sending the data?