private Node pickBestNode(Set<Node> nodes) { Node bestNode = null; // Find a nearby node or pick one arbitrarily for (Node node : nodes) { if (node.isNearby()) { return node; } bestNode = node; } return bestNode; }
private String pickBestNodeId(Set<Node> nodes) {//TODO remove once confirm not needed String bestNodeId = null; // Find a nearby node or pick one arbitrarily for (Node node : nodes) { if (node.isNearby()) { return node.getId(); } bestNodeId = node.getId(); } return bestNodeId; }
private String pickBestNodeId(Set<Node> nodes) { String bestNodeId = null; // Find a nearby node or pick one arbitrarily for (Node node : nodes) { if (node.isNearby()) { return node.getId(); } bestNodeId = node.getId(); } return bestNodeId; }
private String pickBestNodeId(Set<Node> nodes) { String bestNodeId = null; // Find a nearby node or pick one arbitrarily for (Node node : nodes) { if (node.isNearby()) { return node.getId(); } bestNodeId = node.getId(); } return bestNodeId; }
private void updateFindMeCapability(CapabilityInfo capabilityInfo) { Set<Node> connectedNodes = capabilityInfo.getNodes(); if (connectedNodes.isEmpty()) { setupLostConnectivityNotification(); } else { for (Node node : connectedNodes) { // we are only considering those nodes that are directly connected if (node.isNearby()) { ((NotificationManager) getSystemService(NOTIFICATION_SERVICE)) .cancel(FORGOT_PHONE_NOTIFICATION_ID); } } } }
public NodeParcelable(Node node) { this(node.getId(), node.getDisplayName(), 0, node.isNearby()); }
private static void updateBestNode(Context context) { bestNodeId = null; try { CapabilityInfo info = Tasks.await(Wearable.getCapabilityClient(context).getCapability("apde_receive_logs", CapabilityClient.FILTER_REACHABLE)); for (Node node : info.getNodes()) { if (node.isNearby()) { bestNodeId = node.getId(); } } } catch (Exception e) { // Don't call printStackTrace() because that would make an infinite loop Log.e("apde", e.toString()); } }
@Override public void run() { boolean successful = false; try { CapabilityInfo info = Tasks.await(Wearable.getCapabilityClient(context).getCapability("apde_run_watch_sketches", CapabilityClient.FILTER_REACHABLE)); for (Node node : info.getNodes()) { if (node.isNearby()) { successful = true; break; } } } catch (ExecutionException | InterruptedException e) { e.printStackTrace(); } if (successful) { callback.success(); } else { callback.failure(); } } })).start();