MessageEvent
Stay organized with collections
Save and categorize content based on your preferences.
Information about a message received by a listener
.
Public Method Summary
abstract byte[] |
getData()
Returns the data passed by the message.
|
abstract String
|
getPath()
Returns the path the message is being delivered to
|
abstract int |
getRequestId()
Returns the request id of the message, generated by the sender
|
abstract String
|
|
Public Methods
public abstract byte[]
getData ()
Returns the data passed by the message.
public abstract String getPath ()
Returns the path the message is being delivered to
public abstract int getRequestId ()
Returns the request id of the message, generated by the sender
public abstract String getSourceNodeId ()
Returns the node ID of the sender.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-11-21 UTC.
[null,null,["Last updated 2024-11-21 UTC."],[[["\u003cp\u003e\u003ccode\u003eMessageEvent\u003c/code\u003e provides information about messages received by a \u003ccode\u003eMessageApi.MessageListener\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eIt includes methods to access the message data, delivery path, request ID, and the sender's node ID.\u003c/p\u003e\n"],["\u003cp\u003eThe message data is returned as a byte array using \u003ccode\u003egetData()\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003egetPath()\u003c/code\u003e provides the destination path of the message.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003egetRequestId()\u003c/code\u003e and \u003ccode\u003egetSourceNodeId()\u003c/code\u003e return the sender's request ID and node ID, respectively.\u003c/p\u003e\n"]]],["The `MessageEvent` interface provides details about a received message. Key information includes: `getData()`, which retrieves the message's data as a byte array; `getPath()`, which gets the message's delivery path; `getRequestId()`, which returns the sender-generated message ID; and `getSourceNodeId()`, which reveals the ID of the message's sender. A listener receives these details.\n"],null,["# MessageEvent\n\npublic interface **MessageEvent** \nInformation about a message received by a [listener](/android/reference/com/google/android/gms/wearable/MessageApi.MessageListener). \n\n### Public Method Summary\n\n|----------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract byte\\[\\] | [getData](/android/reference/com/google/android/gms/wearable/MessageEvent#getData())() Returns the data passed by the message. |\n| abstract [String](//developer.android.com/reference/java/lang/String.html) | [getPath](/android/reference/com/google/android/gms/wearable/MessageEvent#getPath())() Returns the path the message is being delivered to |\n| abstract int | [getRequestId](/android/reference/com/google/android/gms/wearable/MessageEvent#getRequestId())() Returns the request id of the message, generated by the sender |\n| abstract [String](//developer.android.com/reference/java/lang/String.html) | [getSourceNodeId](/android/reference/com/google/android/gms/wearable/MessageEvent#getSourceNodeId())() Returns the node ID of the sender. |\n\nPublic Methods\n--------------\n\n#### public abstract byte\\[\\]\n**getData** ()\n\nReturns the data passed by the message. \n\n#### public abstract [String](//developer.android.com/reference/java/lang/String.html) **getPath** ()\n\nReturns the path the message is being delivered to \n\n#### public abstract int **getRequestId** ()\n\nReturns the request id of the message, generated by the sender \n\n#### public abstract [String](//developer.android.com/reference/java/lang/String.html) **getSourceNodeId** ()\n\nReturns the node ID of the sender."]]