PutDataRequest | Android Developers

Quicknav Quicknav
Links

- Google Play Developer Console
- Android Developers Blog
- About Android

Android Sites

- Android.com
- Android Developers
- Android Open Source Project

Language
close

- - About
  - Wear
  - TV
  - Auto
- - Get Started
  - Devices
  - Style
  - Patterns
  - Building Blocks
  - Downloads
  - Videos
- - Training
  - API Guides
  - Reference
  - Tools
  - Google Services
  - Samples
- - Google Play
  - Essentials
  - Get Users
  - Engage & Retain
  - Monetize
  - Tools & Reference
  - Developer Stories

## Results

Loading...
Summary: Constants | Inherited Constants | Fields | Methods | Inherited Methods | [Expand All]
public class

# PutDataRequest

extends Object
implements SafeParcelable

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 |

[Expand] Inherited Constants
From interface android.os.Parcelable
int | CONTENTS_FILE_DESCRIPTOR |
int | PARCELABLE_WRITE_RETURN_VALUE |
From interface com.google.android.gms.common.internal.safeparcel.SafeParcelable
String | NULL |

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.
int | describeContents()
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)
PutDataRequest | putAsset(String key, Asset value) Adds an asset to the data item.
PutDataRequest | removeAsset(String key) Removes a previoulsy added asset.
PutDataRequest | setData(byte[] data) Sets the data in a data item.
String | toString(boolean verbose)
String | toString()
void | writeToParcel(Parcel dest, int flags)

[Expand] Inherited Methods
From class java.lang.Object
Object | clone()
boolean | equals(Object arg0)
void | finalize()
final Class<?> | getClass()
int | hashCode()
final void | notify()
final void | notifyAll()
String | toString()
final void | wait()
final void | wait(long arg0, int arg1)
final void | wait(long arg0)
From interface android.os.Parcelable
abstract int | describeContents()
abstract void | writeToParcel(Parcel arg0, int arg1)

## Constants

#### public static final String WEAR_URI_SCHEME

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.

#### 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 int describeContents ()

#### public Asset getAsset (String key)

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

#### public Map<String, Asset> getAssets ()

##### Returns

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

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

#### public boolean hasAsset (String key)

##### Returns

- `true` if the asset exists in this data item.

#### public PutDataRequest putAsset (String key, Asset value)

Adds an asset to the data item.

#### public PutDataRequest removeAsset (String key)

Removes a previoulsy added asset.

#### public PutDataRequest setData (byte[] data)

Sets the data in a data item.

#### public String toString (boolean verbose)

#### public String toString ()

#### public void writeToParcel (Parcel dest, int flags)