public interface

DataApi

com.google.android.gms.wearable.DataApi

Class Overview

Exposes an API for components to read or write DataItems and Assets.

A DataItem is synchronized across all devices in an Android Wear network. DataItems should generally be smaller in size, relying on Assets for the storage of larger, more persistent data objects such as images.

DataItems are identified by a Uri, accessible with getUri() that indicates the item's creator and path.

A DataItem is private to the application that created it and accessibly only by that application on other nodes.

Summary

Nested Classes
interface DataApi.DataItemResult Contains a single data item. 
interface DataApi.DataListener Used with addListener(GoogleApiClient, DataApi.DataListener) to receive data events. 
interface DataApi.DeleteDataItemsResult Contains the number of deleted items. 
interface DataApi.GetFdForAssetResult Contains a file descriptor for the requested asset. 
Public Methods
abstract PendingResult<Status> addListener(GoogleApiClient client, DataApi.DataListener listener)
Registers a listener to receive data item changed and deleted events.
abstract PendingResult<DataApi.DeleteDataItemsResult> deleteDataItems(GoogleApiClient client, Uri uri)
Removes all specified DataItems from the Android Wear network.
abstract PendingResult<DataApi.DataItemResult> getDataItem(GoogleApiClient client, Uri uri)
Retrieves a single DataItem from the Android Wear network.
abstract PendingResult<DataItemBuffer> getDataItems(GoogleApiClient client)
Retrieves all DataItems from the Android Wear network.
abstract PendingResult<DataItemBuffer> getDataItems(GoogleApiClient client, Uri uri)
Retrieves all DataItems matching the provided Uri, from the Android Wear network.
abstract PendingResult<DataApi.GetFdForAssetResult> getFdForAsset(GoogleApiClient client, DataItemAsset asset)
Retrieves a ParcelFileDescriptor pointing at the bytes of an asset.
abstract PendingResult<DataApi.GetFdForAssetResult> getFdForAsset(GoogleApiClient client, Asset asset)
Retrieves a ParcelFileDescriptor pointing at the bytes of an asset.
abstract PendingResult<DataApi.DataItemResult> putDataItem(GoogleApiClient client, PutDataRequest request)
Adds DataItem to the Android Wear network.
abstract PendingResult<Status> removeListener(GoogleApiClient client, DataApi.DataListener listener)
Removes a data listener.

Public Methods

public abstract PendingResult<Status> addListener (GoogleApiClient client, DataApi.DataListener listener)

Registers a listener to receive data item changed and deleted events.

public abstract PendingResult<DataApi.DeleteDataItemsResult> deleteDataItems (GoogleApiClient client, Uri uri)

Removes all specified DataItems from the Android Wear network.

Using glob uri selectors will allow this call to delete multiple data items at once.

public abstract PendingResult<DataApi.DataItemResult> getDataItem (GoogleApiClient client, Uri uri)

Retrieves a single DataItem from the Android Wear network. A fully qualified Uri must be specified. The uri's host must be a node that created the item.

public abstract PendingResult<DataItemBuffer> getDataItems (GoogleApiClient client)

Retrieves all DataItems from the Android Wear network.

Callers should call release() when finished processing results.

public abstract PendingResult<DataItemBuffer> getDataItems (GoogleApiClient client, Uri uri)

Retrieves all DataItems matching the provided Uri, from the Android Wear network. The Uri should contain a path, if the host is elided, all data items matching that path are returned.

Callers should call release() when finished processing results.

public abstract PendingResult<DataApi.GetFdForAssetResult> getFdForAsset (GoogleApiClient client, DataItemAsset asset)

Retrieves a ParcelFileDescriptor pointing at the bytes of an asset. Only assets previously stored in a DataItem may be retrieved.

public abstract PendingResult<DataApi.GetFdForAssetResult> getFdForAsset (GoogleApiClient client, Asset asset)

Retrieves a ParcelFileDescriptor pointing at the bytes of an asset. Only assets previously stored in a DataItem may be retrieved.

public abstract PendingResult<DataApi.DataItemResult> putDataItem (GoogleApiClient client, PutDataRequest request)

Adds DataItem to the Android Wear network. The updated item is synchronized across all devices.

public abstract PendingResult<Status> removeListener (GoogleApiClient client, DataApi.DataListener listener)

Removes a data listener.