PutDataRequest Stay organized with collections Save and categorize content based on your preferences.
Page Summary
PutDataRequest is used to create new data items in the Android Wear network.
The class includes constants like WEAR_URI_SCHEME and methods to create, get, add, remove, and set data or assets on a data item.
It also provides methods to manage the urgency of data item transport and is Parcelable for efficient data transfer.
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
| int | CONTENTS_FILE_DESCRIPTOR | |
| int | PARCELABLE_WRITE_RETURN_VALUE |
Field Summary
| public static finalCreator<PutDataRequest> | CREATOR |
Public Method Summary
| staticPutDataRequest | |
| staticPutDataRequest | createFromDataItem(DataItem source) Creates a PutDataRequest from an existingDataItem using the provided source. |
| staticPutDataRequest | 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
| abstract int | describeContents() |
| abstract void | writeToParcel(Parcel arg0, int arg1) |
Constants
Fields
public static finalCreator<PutDataRequest>CREATOR
Public Methods
public staticPutDataRequestcreate(String path)
Creates aPutDataRequest with the provided, complete, path.
public staticPutDataRequestcreateFromDataItem(DataItem source)
Creates aPutDataRequest from an existingDataItem using the provided source.
public staticPutDataRequestcreateWithAutoAppendedId(String pathPrefix)
Creates aPutDataRequest with a randomly generated id prefixed with the provided path.
publicAssetgetAsset(String key)
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(String key)
Returnstrue if the asset exists in this data item.
public booleanisUrgent()
publicPutDataRequestputAsset(String key,Asset value)
Adds anAsset to the data item.
publicPutDataRequestremoveAsset(String key)
Removes a previously addedAsset.
publicPutDataRequestsetData(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.
publicPutDataRequestsetUrgent()
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(Parcel dest, int flags)
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-11-21 UTC.