Summary: Constants | Inherited Constants | Ctors | Methods | Inherited Methods | [Expand All]
public final class

# Device

extends Object
implements SafeParcelable

java.lang.Object
↳ | com.google.android.gms.fitness.data.Device

## Class Overview

Representation of an integrated device (such as a phone or a wearable) that can hold sensors. Each sensor is exposed as a `DataSource`.

The main purpose of the Device information contained in this class is to identify the hardware of a particular data source. This can be useful in different ways, including:

- distinguishing two similar sensors on different devices (the step counter on two nexus 5 phones, for instance)
- display the source of data to the user (by using the device make / model)
- treat data differently depending on sensor type (accelerometers on a watch may give different patterns than those on a phone)
- build different analysis models for each device/version.

## Summary

Constants
int | TYPE_CHEST_STRAP | Constant indicating the device is a chest strap.
int | TYPE_PHONE | Constant indicating the device is an Android phone.
int | TYPE_SCALE | Constant indicating the device is a scale or similar device the user steps on.
int | TYPE_TABLET | Constant indicating the device is an Android tablet.
int | TYPE_UNKNOWN | Constant indicating the device type is not known.
int | TYPE_WATCH | Constant indicating the device is a watch or other wrist-mounted band.

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

Public Constructors
| Device(String manufacturer, String model, String uid, int type) Creates a new device.

Public Methods
boolean | equals(Object that)
static Device | getLocalDevice(Context context) Returns the Device representation of the local device, which can be used when defining local data sources.
String | getManufacturer() Returns the manufacturer of the product/hardware.
String | getModel() Returns the end-user-visible model name for the device.
int | getType() Returns the constant representing the type of the device.
String | getUid() Returns the serial number or other unique ID for the hardware
int | hashCode()
String | toString()
void | writeToParcel(Parcel parcel, 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(long arg0, int arg1)
final void | wait(long arg0)
final void | wait()
From interface android.os.Parcelable
abstract int | describeContents()
abstract void | writeToParcel(Parcel arg0, int arg1)

## Constants

#### public static final int TYPE_CHEST_STRAP

Constant indicating the device is a chest strap.

Constant Value: 4 (0x00000004)

#### public static final int TYPE_PHONE

Constant indicating the device is an Android phone.

Constant Value: 1 (0x00000001)

#### public static final int TYPE_SCALE

Constant indicating the device is a scale or similar device the user steps on.

Constant Value: 5 (0x00000005)

#### public static final int TYPE_TABLET

Constant indicating the device is an Android tablet.

Constant Value: 2 (0x00000002)

#### public static final int TYPE_UNKNOWN

Constant indicating the device type is not known.

Constant Value: 0 (0x00000000)

#### public static final int TYPE_WATCH

Constant indicating the device is a watch or other wrist-mounted band.

Constant Value: 3 (0x00000003)

## Public Constructors

#### public Device (String manufacturer, String model, String uid, int type)

Creates a new device.

##### Parameters

manufacturer | the manufacturer of the product/hardware
model | the end-user-visible name for the end product
uid | a serial number or other unique identifier for the particular device hardware
type | the type of device. One of the type constants.

## Public Methods

#### public boolean equals (Object that)

#### public static Device getLocalDevice (Context context)

Returns the Device representation of the local device, which can be used when defining local data sources.

#### public String getManufacturer ()

Returns the manufacturer of the product/hardware.

#### public String getModel ()

Returns the end-user-visible model name for the device.

#### public int getType ()

Returns the constant representing the type of the device. This will usually be one of the values from the type constants in this class, but it's not required to be. Any other value should be treated as `TYPE_UNKNOWN`.

#### public String getUid ()

Returns the serial number or other unique ID for the hardware

#### public int hashCode ()

#### public String toString ()

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