I\'m testing the Wearable Data Layer Api as described in the Android tutorial.
There is a low level API based around DataItem, which can have only a byte array
The uri's authority (which is described as
private Uri getUriForDataItem() {
// If you've put data on the local node
String nodeId = getLocalNodeId();
// Or if you've put data on the remote node
// String nodeId = getRemoteNodeId();
// Or If you already know the node id
// String nodeId = "some_node_id";
return new Uri.Builder().scheme(PutDataRequest.WEAR_URI_SCHEME).authority(nodeId).path("/path_to_data").build();
}
private String getLocalNodeId() {
NodeApi.GetLocalNodeResult nodeResult = Wearable.NodeApi.getLocalNode(mGoogleApiClient).await();
return nodeResult.getNode().getId();
}
private String getRemoteNodeId() {
HashSet results = new HashSet();
NodeApi.GetConnectedNodesResult nodesResult =
Wearable.NodeApi.getConnectedNodes(mGoogleApiClient).await();
List nodes = nodesResult.getNodes();
if (nodes.size() > 0) {
return nodes.get(0).getId();
}
return null;
}