PutDataRequest

public classPutDataRequestextendsObject
implementsParcelable

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
create(Stringpath)
Creates aPutDataRequest with the provided, complete, path.
staticPutDataRequest
createFromDataItem(DataItem source)
Creates aPutDataRequest from an existing DataItem using the provided source.
staticPutDataRequest
createWithAutoAppendedId(StringpathPrefix)
Creates aPutDataRequest with a randomly generated id prefixed with the provided path.
Asset
getAsset(Stringkey)
Returns anAsset previously added with putAsset(String, Asset).
Map<String,Asset>
getAssets()
Returns unmodifiable map ofAssets on thisDataItem.
byte[]
getData()
An array of data stored at the specifiedUri.
Uri
getUri()
Returns aUrifor the pending data item.
boolean
hasAsset(Stringkey)
Returnstrueif the asset exists in this data item.
boolean
isUrgent()
Whether theDataItem for this request is urgent.
PutDataRequest
putAsset(Stringkey, Asset value)
Adds anAsset to the data item.
PutDataRequest
removeAsset(Stringkey)
Removes a previously addedAsset.
PutDataRequest
setData(byte[] data)
Sets the data in a data item.
PutDataRequest
setUrgent()
Flags thisDataItem for urgent transport.
String
String
toString(boolean verbose)
void
writeToParcel(Parceldest, int flags)

Inherited Method Summary

Constants

public static finalString WEAR_URI_SCHEME

URI scheme to use for Wear URIs. SeeDataApi for details of the Wear URI format.

Constant Value:"wear"

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).

publicMap<String,Asset> getAssets()

Returns unmodifiable map ofAssets on thisDataItem.

public byte[]getData()

An array of data stored at the specifiedUri.PutDataMapRequest may be used to store structured data in the network.

publicUrigetUri()

Returns aUrifor 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)

Returnstrueif the asset exists in this data item.

public booleanisUrgent()

Whether theDataItem for this request is urgent.

Returns
  • true if theDataItem for this request is urgent

publicPutDataRequest putAsset(Stringkey,Asset value)

Adds anAssetto 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.nullis only allowed for backwards compatibility.

publicPutDataRequest setUrgent()

Flags thisDataItem for urgent transport. Updates toDataItems 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-urgentDataItems will be delayed no longer than 30 minutes, subject to a connected peer, but are expected to arrive much sooner.

Clients should onlysetUrgent() forDataItems which need to be delivered right away.

publicStringtoString()

publicStringtoString(boolean verbose)

public voidwriteToParcel(Parceldest, int flags)