Device

public final class Device extends AbstractSafeParcelable

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.

Constant Summary

int TYPE_CHEST_STRAP Constant indicating the device is a chest strap.
int TYPE_HEAD_MOUNTED Constant indicating the device is a headset, pair of glasses, or other head-mounted device
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.

Inherited Constant Summary

Public Constructor Summary

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

Public Method Summary

boolean
equals(Object other)
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
String
void
writeToParcel(Parcel parcel, int flags)

Inherited Method Summary

Constants

public static final int TYPE_CHEST_STRAP

Constant indicating the device is a chest strap.

Constant Value: 4

public static final int TYPE_HEAD_MOUNTED

Constant indicating the device is a headset, pair of glasses, or other head-mounted device

Constant Value: 6

public static final int TYPE_PHONE

Constant indicating the device is an Android phone.

Constant Value: 1

public static final int TYPE_SCALE

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

Constant Value: 5

public static final int TYPE_TABLET

Constant indicating the device is an Android tablet.

Constant Value: 2

public static final int TYPE_UNKNOWN

Constant indicating the device type is not known.

Constant Value: 0

public static final int TYPE_WATCH

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

Constant Value: 3

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 other)

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)