Java Code Examples for com.google.android.gms.wearable.NodeApi#GetLocalNodeResult

The following examples show how to use com.google.android.gms.wearable.NodeApi#GetLocalNodeResult . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ListenerService.java    From xDrip with GNU General Public License v3.0 6 votes vote down vote up
private void setLocalNodeName () {
    forceGoogleApiConnect();
    PendingResult<NodeApi.GetLocalNodeResult> result = Wearable.NodeApi.getLocalNode(googleApiClient);
    result.setResultCallback(new ResultCallback<NodeApi.GetLocalNodeResult>() {
        @Override
        public void onResult(NodeApi.GetLocalNodeResult getLocalNodeResult) {
            if (!getLocalNodeResult.getStatus().isSuccess()) {
                Log.e(TAG, "ERROR: failed to getLocalNode Status=" + getLocalNodeResult.getStatus().getStatusMessage());
            } else {
                Log.d(TAG, "getLocalNode Status=: " + getLocalNodeResult.getStatus().getStatusMessage());
                Node getnode = getLocalNodeResult.getNode();
                localnode = getnode != null ? getnode.getDisplayName() + "|" + getnode.getId() : "";
                Log.d(TAG, "setLocalNodeName.  localnode=" + localnode);
            }
        }
    });
}
 
Example 2
Source File: ListenerService.java    From xDrip-plus with GNU General Public License v3.0 6 votes vote down vote up
private void setLocalNodeName () {
    forceGoogleApiConnect();
    PendingResult<NodeApi.GetLocalNodeResult> result = Wearable.NodeApi.getLocalNode(googleApiClient);
    result.setResultCallback(new ResultCallback<NodeApi.GetLocalNodeResult>() {
        @Override
        public void onResult(NodeApi.GetLocalNodeResult getLocalNodeResult) {
            if (!getLocalNodeResult.getStatus().isSuccess()) {
                Log.e(TAG, "ERROR: failed to getLocalNode Status=" + getLocalNodeResult.getStatus().getStatusMessage());
            } else {
                Log.d(TAG, "getLocalNode Status=: " + getLocalNodeResult.getStatus().getStatusMessage());
                Node getnode = getLocalNodeResult.getNode();
                localnode = getnode != null ? getnode.getDisplayName() + "|" + getnode.getId() : "";
                Log.d(TAG, "setLocalNodeName.  localnode=" + localnode);
            }
        }
    });
}
 
Example 3
Source File: ListenerService.java    From AndroidAPS with GNU Affero General Public License v3.0 6 votes vote down vote up
private void setLocalNodeName() {
    forceGoogleApiConnect();
    PendingResult<NodeApi.GetLocalNodeResult> result = Wearable.NodeApi.getLocalNode(googleApiClient);
    result.setResultCallback(new ResultCallback<NodeApi.GetLocalNodeResult>() {

        @Override
        public void onResult(NodeApi.GetLocalNodeResult getLocalNodeResult) {
            if (!getLocalNodeResult.getStatus().isSuccess()) {
                Log.e(TAG, "ERROR: failed to getLocalNode Status="
                    + getLocalNodeResult.getStatus().getStatusMessage());
            } else {
                Log.d(TAG, "getLocalNode Status=: " + getLocalNodeResult.getStatus().getStatusMessage());
                Node getnode = getLocalNodeResult.getNode();
                localnode = getnode != null ? getnode.getDisplayName() + "|" + getnode.getId() : "";
                Log.d(TAG, "setLocalNodeName.  localnode=" + localnode);
            }
        }
    });
}
 
Example 4
Source File: WatchUpdaterService.java    From xDrip with GNU General Public License v3.0 5 votes vote down vote up
private void setLocalNodeName() {
    forceGoogleApiConnect();
    NodeApi.GetLocalNodeResult localnodes = Wearable.NodeApi.getLocalNode(googleApiClient).await(60, TimeUnit.SECONDS);
    Node getnode = localnodes.getNode();
    localnode = getnode != null ? getnode.getDisplayName() + "|" + getnode.getId() : "";
    UserError.Log.d(TAG, "setLocalNodeName.  localnode=" + localnode);
}
 
Example 5
Source File: WatchUpdaterService.java    From xDrip-plus with GNU General Public License v3.0 5 votes vote down vote up
private void setLocalNodeName() {
    forceGoogleApiConnect();
    NodeApi.GetLocalNodeResult localnodes = Wearable.NodeApi.getLocalNode(googleApiClient).await(60, TimeUnit.SECONDS);
    Node getnode = localnodes.getNode();
    localnode = getnode != null ? getnode.getDisplayName() + "|" + getnode.getId() : "";
    UserError.Log.d(TAG, "setLocalNodeName.  localnode=" + localnode);
}
 
Example 6
Source File: GoogleApiMessenger.java    From Sensor-Data-Logger with Apache License 2.0 5 votes vote down vote up
public void updateLocalNode() {
    PendingResult<NodeApi.GetLocalNodeResult> pendingResult = Wearable.NodeApi.getLocalNode(googleApiClient);
    pendingResult.setResultCallback(new ResultCallback<NodeApi.GetLocalNodeResult>() {
        @Override
        public void onResult(@NonNull NodeApi.GetLocalNodeResult getLocalNodeResult) {
            status.setLocalNode(getLocalNodeResult.getNode());
            status.updated(statusUpdateHandler);
            wearableApiAvailable = getLocalNodeResult.getNode() != null;
        }
    });
}
 
Example 7
Source File: ConfigHelper.java    From FORMWatchFace with Apache License 2.0 5 votes vote down vote up
public String getLocalNodeId() {
    NodeApi.GetLocalNodeResult localNodeResult = Wearable.NodeApi.getLocalNode(mGoogleApiClient).await();
    if (!localNodeResult.getStatus().isSuccess()) {
        Log.e(TAG, "Error getting local node info: " + localNodeResult.getStatus().getStatusMessage());
    }

    return localNodeResult.getNode().getId();
}
 
Example 8
Source File: Utils.java    From ETSMobile-Android2 with Apache License 2.0 4 votes vote down vote up
public static String getLocalNodeId(GoogleApiClient googleApiClient) {
    NodeApi.GetLocalNodeResult nodeResult = Wearable.NodeApi.getLocalNode(googleApiClient).await();
    return nodeResult.getNode().getId();
}
 
Example 9
Source File: MainActivity.java    From ETSMobile-Android2 with Apache License 2.0 4 votes vote down vote up
private String getLocalNodeId(GoogleApiClient googleApiClient) {
    NodeApi.GetLocalNodeResult nodeResult = Wearable.NodeApi.getLocalNode(googleApiClient).await();
    return nodeResult.getNode().getId();
}
 
Example 10
Source File: SunsetsGeneralWearableConfigActivity.java    From american-sunsets-watch-face with Apache License 2.0 4 votes vote down vote up
private String getLocalNodeId() {
    NodeApi.GetLocalNodeResult nodeResult = Wearable.NodeApi.getLocalNode(mGoogleApiClient).await();
    return nodeResult.getNode().getId();
}