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 final Creator<PutDataRequest> | CREATOR |
Public Method Summary
static PutDataRequest | |
static PutDataRequest |
createFromDataItem(DataItem
source)
Creates a
PutDataRequest
from an existing DataItem
using the provided source.
|
static PutDataRequest |
createWithAutoAppendedId(String pathPrefix)
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(Parcel dest, int
flags)
|
Inherited Method Summary
Constants
Fields
public static final Creator<PutDataRequest> CREATOR
Public Methods
public static PutDataRequest create (String path)
Creates a PutDataRequest
with the provided, complete, path.
public static PutDataRequest createFromDataItem (DataItem source)
Creates a PutDataRequest
from an existing DataItem
using the provided source.
public static PutDataRequest createWithAutoAppendedId (String pathPrefix)
Creates a PutDataRequest
with a randomly generated id prefixed with the provided path.
public Asset getAsset (String key)
Returns an Asset
previously added with
putAsset(String, Asset)
.
public byte[] getData ()
An array of data stored at the specified Uri
. PutDataMapRequest
may be used to store structured data in the network.
public Uri getUri ()
Returns a Uri
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 boolean hasAsset (String key)
Returns true
if the asset exists in this data item.
public boolean isUrgent ()
public PutDataRequest putAsset (String key, Asset value)
Adds an Asset
to the
data item.
public PutDataRequest removeAsset (String key)
Removes a previously added Asset
.
public PutDataRequest 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.
public PutDataRequest setUrgent ()
Flags this DataItem
for urgent transport. Updates to DataItem
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-urgent DataItem
s
will be delayed no longer than 30 minutes, subject to a connected peer, but are
expected to arrive much sooner.
Clients should only setUrgent()
for DataItem
s
which need to be delivered right away.