I'm trying to send an event or better a message to the mobile while the wearable is disconnected.
Here is the code I'm using:
Wearable.MessageApi.sendMessage(
mGoogleApiClient, node, event, message).setResultCallback(
new ResultCallback<MessageApi.SendMessageResult>() {
@Override
public void onResult(MessageApi.SendMessageResult sendMessageResult) {
if(!sendMessageResult.getStatus().isSuccess()) {
Log.e(TAG, "Failed to send message with status code: "
+ sendMessageResult.getStatus().getStatusCode());
}
}
}
);
The node ID is cached when onPeerConnected(Node peer)
is called so I don't need to query the Node API to get an empty list. However I send the data to the node which is offline. That results the StatusCode 4000 which is TARGET_NODE_NOT_CONNECTED
. Of course I know that, but what is the best way to cache this event to send it as soon as possible?