本文整理匯總了Java中com.google.android.gms.wearable.NodeApi.GetLocalNodeResult方法的典型用法代碼示例。如果您正苦於以下問題:Java NodeApi.GetLocalNodeResult方法的具體用法?Java NodeApi.GetLocalNodeResult怎麽用?Java NodeApi.GetLocalNodeResult使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.google.android.gms.wearable.NodeApi
的用法示例。
在下文中一共展示了NodeApi.GetLocalNodeResult方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setLocalNodeName
import com.google.android.gms.wearable.NodeApi; //導入方法依賴的package包/類
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);
}
}
});
}
示例2: run
import com.google.android.gms.wearable.NodeApi; //導入方法依賴的package包/類
@Override
public void run() {
final GoogleApiClient mGoogleApiClient = new GoogleApiClient.Builder(mContext).addApi(Wearable.API).build();
mGoogleApiClient.connect();
final PendingResult<NodeApi.GetLocalNodeResult> localNode = Wearable.NodeApi.getLocalNode(mGoogleApiClient);
localNode.setResultCallback(new ResultCallback<NodeApi.GetLocalNodeResult>() {
@Override
public void onResult(NodeApi.GetLocalNodeResult result) {
mNode = result.getNode();
sendMessage(CONNECTED_PATH, mNode.getId());
}
});
}
示例3: setLocalNodeName
import com.google.android.gms.wearable.NodeApi; //導入方法依賴的package包/類
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);
}
示例4: updateLocalNode
import com.google.android.gms.wearable.NodeApi; //導入方法依賴的package包/類
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;
}
});
}
示例5: getLocalNodeId
import com.google.android.gms.wearable.NodeApi; //導入方法依賴的package包/類
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();
}
示例6: getLocalNodeId
import com.google.android.gms.wearable.NodeApi; //導入方法依賴的package包/類
private String getLocalNodeId() {
NodeApi.GetLocalNodeResult nodeResult = Wearable.NodeApi.getLocalNode(mGoogleApiClient).await();
return nodeResult.getNode().getId();
}
開發者ID:marcouberti,項目名稱:american_sunsets_watch_face,代碼行數:5,代碼來源:SunsetsGeneralWearableConfigActivity.java
示例7: onConnected
import com.google.android.gms.wearable.NodeApi; //導入方法依賴的package包/類
@Override
public void onConnected(Bundle bundle) {
Log.d( TAG, "GoogleApiClient.ConnectionCallbacks::onConnected() " + Wearable.API.getName() ) ;
PendingResult<NodeApi.GetLocalNodeResult> getLocalNodePendingResult = Wearable.NodeApi.getLocalNode( googleApiClient ) ;
final StringBuffer nodeInfoText = new StringBuffer() ;
getLocalNodePendingResult.setResultCallback(new ResultCallback<NodeApi.GetLocalNodeResult>() {
@Override
public void onResult(NodeApi.GetLocalNodeResult getLocalNodeResult) {
Log.d ( TAG, "GoogleApiClient.ConnectionCallbacks::onConnected()-NodeApi.GetLocalNodeResult getLocalNodeResult::onResult getLocalNodeResult= " + getLocalNodeResult ) ;
aNode = getLocalNodeResult.getNode() ;
Log.d ( TAG, "GoogleApiClient.ConnectionCallbacks::onConnected()-NodeApi.GetLocalNodeResult getLocalNodeResult::onResult aNode(local)=" + aNode ) ;
//foundNodesTextView.setText( aNode.toString()) ;
nodeInfoText.append("Local " + aNode.toString()) ;
//OUTPUT Node{Gear Live 772A, id=ab1f00d5, hops=0, isNearby=true}
}
});
final PendingResult<NodeApi.GetConnectedNodesResult> getConnectedNodesPendingResult = Wearable.NodeApi.getConnectedNodes( googleApiClient) ;
getConnectedNodesPendingResult.setResultCallback(new ResultCallback<NodeApi.GetConnectedNodesResult>() {
@Override
public void onResult(NodeApi.GetConnectedNodesResult getConnectedNodesResult) {
Log.d ( TAG, "GoogleApiClient.ConnectionCallbacks::onConnected()-NodeApi.GetConnectedNodesCallback::onResult getConnectedNodesPendingResult = " + getConnectedNodesPendingResult ) ;
List<Node> connectedNodesList = getConnectedNodesResult.getNodes() ;
String tmpString = Arrays.deepToString(connectedNodesList.toArray() );
nodeInfoText.append ( "\n Connected " + tmpString) ;
//OUTPUT [Node{Nexus 6, id=30680774, hops=1, isNearby=true}, Node{cloud, id=cloud, hops=2, isNearby=false}]
Log.d ( TAG, "GoogleApiClient.ConnectionCallbacks::onConnected()-NodeApi.GetConnectedNodesCallback::onResult getConnectedNodesPendingResult = " + tmpString ) ;
foundNodesTextView.setText( nodeInfoText);
}
});
}
示例8: onResult
import com.google.android.gms.wearable.NodeApi; //導入方法依賴的package包/類
void onResult(NodeApi.GetLocalNodeResult localNode);