PutDataRequest
is used to create new data items in the Android Wear network.
Constant Summary
String | WEAR_URI_SCHEME | URI scheme to use for Wear URIs. |
Inherited Constant Summary
Field Summary
public static finalCreator<PutDataRequest> | CREATOR |
Public Method Summary
staticPutDataRequest | |
staticPutDataRequest |
createFromDataItem(DataItem
source)
Creates a
PutDataRequest
from an existing DataItem using the provided source.
|
staticPutDataRequest |
createWithAutoAppendedId(StringpathPrefix)
Creates a
PutDataRequest
with a randomly generated id prefixed with the provided path.
|
Asset | |
Map<String,Asset> | |
byte[] | |
Uri | |
boolean | |
boolean | |
PutDataRequest | |
PutDataRequest | |
PutDataRequest |
setData(byte[] data)
Sets the data in a data item.
|
PutDataRequest | |
String |
toString()
|
String |
toString(boolean verbose)
|
void |
writeToParcel(Parceldest, int
flags)
|
Inherited Method Summary
Constants
Fields
public static finalCreator<PutDataRequest> CREATOR
Public Methods
public staticPutDataRequest create(Stringpath)
Creates aPutDataRequest
with the provided, complete, path.
public staticPutDataRequest createFromDataItem(DataItem source)
Creates aPutDataRequest
from an existing DataItem using the provided source.
public staticPutDataRequest createWithAutoAppendedId(String pathPrefix)
Creates aPutDataRequest
with a randomly generated id prefixed with the provided path.
publicAsset getAsset(Stringkey)
Returns anAsset
previously added with
putAsset(String, Asset)
.
public byte[]getData()
An array of data stored at the specifiedUri
.PutDataMapRequest
may be used to store structured data in the network.
publicUrigetUri()
Returns aUri
for the pending
data item. If this is a modification of an existing data item,Uri.getHost()
will return the id of the node that originally created it. Otherwise, a new data item
will be created with the requesting device's node.
public booleanhasAsset(Stringkey)
Returnstrue
if the asset exists in this data item.
public booleanisUrgent()
publicPutDataRequest putAsset(Stringkey,Asset value)
Adds anAsset
to the
data item.
publicPutDataRequest removeAsset(Stringkey)
Removes a previously addedAsset
.
publicPutDataRequest setData(byte[] data)
Sets the data in a data item.
Note: Use an empty array if there is no data to store.null
is only
allowed for backwards compatibility.
publicPutDataRequest setUrgent()
Flags thisDataItem
for urgent transport. Updates toDataItem
s
with the same path will be applied in the order they are received. A subsequent urgent
update will remove the delay for pending updates. A subsequent delayed update will not
delay pending urgent updates.
Non-urgentDataItem
s
will be delayed no longer than 30 minutes, subject to a connected peer, but are
expected to arrive much sooner.
Clients should onlysetUrgent()
forDataItem
s
which need to be delivered right away.