public class

PutDataRequest

extends Object
implements Parcelable
java.lang.Object
   ↳ com.google.android.gms.wearable.PutDataRequest

Class Overview

PutDataRequest is used to create new data items in the Android Wear network.

Summary

Constants
String WEAR_URI_SCHEME URI scheme to use for Wear URIs.
[Expand]
Inherited Constants
From interface android.os.Parcelable
Fields
public static final Creator<PutDataRequest> CREATOR
Public Methods
static PutDataRequest create(String path)
Creates a dataItem with the provided, complete, path.
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 getAsset(String key)
Returns an asset previously added with putAsset(String, Asset).
Map<String, Asset> getAssets()
byte[] getData()
An array of data stored at the specfied Uri.
Uri getUri()
Returns a Uri for the pending data item.
boolean hasAsset(String key)
boolean isUrgent()
Whether the DataItem for this request is urgent.
PutDataRequest putAsset(String key, Asset value)
Adds an asset to the data item.
PutDataRequest removeAsset(String key)
Removes a previously added asset.
PutDataRequest setData(byte[] data)
Sets the data in a data item.
PutDataRequest setUrgent()
Flags this DataItem for urgent transport.
String toString()
String toString(boolean verbose)
void writeToParcel(Parcel dest, int flags)
[Expand]
Inherited Methods
From class java.lang.Object
From interface android.os.Parcelable

Constants

public static final String WEAR_URI_SCHEME

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

Constant Value: "wear"

Fields

public static final Creator<PutDataRequest> CREATOR

Public Methods

public static PutDataRequest create (String path)

Creates a dataItem with the provided, complete, path.

Parameters
path String
Returns
PutDataRequest

public static PutDataRequest createFromDataItem (DataItem source)

Creates a PutDataRequest from an existing DataItem using the provided source.

Parameters
source DataItem
Returns
PutDataRequest

public static PutDataRequest createWithAutoAppendedId (String pathPrefix)

Creates a PutDataRequest with a randomly generated id prefixed with the provided path.

Parameters
pathPrefix String
Returns
PutDataRequest

public Asset getAsset (String key)

Returns an asset previously added with putAsset(String, Asset).

Parameters
key String
Returns
Asset

public Map<String, Asset> getAssets ()

Returns
Map<String, Asset> unmodifiable map of assets on this dataItem.

public byte[] getData ()

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

Returns
byte[]

public Uri getUri ()

Returns a Uri for the pending data item. If this is a modification of an existing data item, 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.

Returns
Uri

public boolean hasAsset (String key)

Parameters
key String
Returns
boolean true if the asset exists in this data item.

public boolean isUrgent ()

Whether the DataItem for this request is urgent.

Returns
boolean true if the DataItem for this request is urgent

public PutDataRequest putAsset (String key, Asset value)

Adds an asset to the data item.

Parameters
key String
value Asset
Returns
PutDataRequest

public PutDataRequest removeAsset (String key)

Removes a previously added asset.

Parameters
key String
Returns
PutDataRequest

public PutDataRequest setData (byte[] data)

Sets the data in a data item.

Parameters
data byte
Returns
PutDataRequest

public PutDataRequest setUrgent ()

Flags this DataItem for urgent transport. Updates to DataItems 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.

DataItems 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 DataItems which need to be delivered right away.

Returns
PutDataRequest

public String toString ()

Returns
String

public String toString (boolean verbose)

Parameters
verbose boolean
Returns
String

public void writeToParcel (Parcel dest, int flags)

Parameters
dest Parcel
flags int