當前位置: 首頁>>代碼示例>>Java>>正文


Java NodeApi.GetLocalNodeResult方法代碼示例

本文整理匯總了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);
            }
        }
    });
}
 
開發者ID:NightscoutFoundation,項目名稱:xDrip,代碼行數:18,代碼來源:ListenerService.java

示例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());
		}
	});
}
 
開發者ID:ngageoint,項目名稱:mage-chronostouch-android,代碼行數:17,代碼來源:DataManager.java

示例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);
}
 
開發者ID:NightscoutFoundation,項目名稱:xDrip,代碼行數:8,代碼來源:WatchUpdaterService.java

示例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;
        }
    });
}
 
開發者ID:Steppschuh,項目名稱:Sensor-Data-Logger,代碼行數:12,代碼來源:GoogleApiMessenger.java

示例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();
}
 
開發者ID:romannurik,項目名稱:FORMWatchFace,代碼行數:9,代碼來源:ConfigHelper.java

示例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);

        }
    });


}
 
開發者ID:smitzey,項目名稱:wearbooksource,代碼行數:45,代碼來源:MainWearActivity.java

示例8: onResult

import com.google.android.gms.wearable.NodeApi; //導入方法依賴的package包/類
void onResult(NodeApi.GetLocalNodeResult localNode); 
開發者ID:DeviceConnect,項目名稱:DeviceConnect-Android,代碼行數:2,代碼來源:WearManager.java


注:本文中的com.google.android.gms.wearable.NodeApi.GetLocalNodeResult方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。