0

I'm trying to send String from my Moto 360 to Android App! but I don't understand how to implement the code in documentation, can anyone help me please with a little explanation of the steps to follow to send data !

http://developer.android.com/training/wearables/data-layer/messages.html

Elyes
  • 92
  • 1
  • 12

1 Answers1

1

Take a look at a samples, this line exactly shows how to send a message:

http://developer.android.com/samples/DataLayer/Application/src/com.example.android.wearable.datalayer/MainActivity.html#l335

private void sendStartActivityMessage(String node) {
    Wearable.MessageApi.sendMessage(
            mGoogleApiClient, node, START_ACTIVITY_PATH, new byte[0]).setResultCallback(
            new ResultCallback<SendMessageResult>() {
                @Override
                public void onResult(SendMessageResult sendMessageResult) {
                    if (!sendMessageResult.getStatus().isSuccess()) {
                        Log.e(TAG, "Failed to send message with status code: "
                                + sendMessageResult.getStatus().getStatusCode());
                    }
                }
            }
    );
}

If that's too much information, a simpler tutorial for MessageApi should be just a google search away. Try this one: http://www.binpress.com/tutorial/a-guide-to-the-android-wear-message-api/152 it looks reasonable.

gruszczy
  • 40,948
  • 31
  • 128
  • 181