Here is my code:
public void button_sendMessage(){
new SendPhoneTask().execute();
}
public class SendPhoneTask extends AsyncTask<Void, Void, Void> {
@Override
protected Void doInBackground(Void... args) {
Collection<String> nodes = getNodes();
for (String node : nodes) {
sendDataMessage(node);
}
return null;
}
}
private Collection<String> getNodes() {
HashSet<String> results = new HashSet<>();
NodeApi.GetConnectedNodesResult nodes = Wearable.NodeApi
.getConnectedNodes(mGoogleApiClient).await();
for (Node node : nodes.getNodes()) {
results.add(node.getId());
}
return results;
}
I'm trying to send a message from my phone to my android wear device. But error occurs.
What is wrong with my code?