com.google.android.gms.wearable.MessageApi |
Exposes an API for components to send messages to other nodes.
Messages are delivered to connected network nodes. A message is considered successful if it has
been queued for delivery to the specified node. A message will only be queued if the specified
node is connected. The DataApi
should be used for messages to nodes which
are not currently connected (to be delivered on connection).
Messages should generally contain ephemeral, small payloads. Use assets
with the DataApi
to store more persistent or larger data efficiently.
A message is private to the application that created it and accessible only by that application on other nodes.
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
MessageApi.MessageListener |
Used with addListener(GoogleApiClient, MessageApi.MessageListener) to receive message events.
|
||||||||||
MessageApi.SendMessageResult | Contains the request id assigned to the message. |
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
int | UNKNOWN_REQUEST_ID |
A value returned by getRequestId() when sendMessage(GoogleApiClient, String, String, byte[]) fails.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Registers a listener to be notified of received messages.
| |||||||||||
Removes a message listener which was previously added through
addListener(GoogleApiClient, MessageListener) .
| |||||||||||
Sends
byte[] data to the specified node.
|
A value returned by getRequestId()
when sendMessage(GoogleApiClient, String, String, byte[])
fails.
Registers a listener to be notified of received messages. Calls to this method should
balanced with removeListener(GoogleApiClient, MessageListener)
to avoid leaking
resources.
Callers wishing to be notified of events in the background should use
WearableListenerService
.
Removes a message listener which was previously added through
addListener(GoogleApiClient, MessageListener)
.
Sends byte[]
data to the specified node.
nodeId | identifier for a particular node on the Android Wear network. Valid targets
may be obtained through getConnectedNodes(GoogleApiClient) or from
the host in getUri() . |
---|---|
path | identifier used to specify a particular endpoint at the receiving node |
data | small array of information to pass to the target node. Generally not larger than 100k |