DataPoints

@Keep object DataPoints


Helper class to facilitate working with DataPoint s.

Summary

Constants

static final int

When using DataType.LOCATION, the value is represented as double[].

static final int

When using DataType.LOCATION, the value is represented as double[].

static final int

When using DataType.LOCATION, the value is represented as double[].

static final int

When using DataType.LOCATION, the value is represented as double[].

Public methods

static final @NonNull DataPoint
absoluteElevation(
    double meters,
    @NonNull Duration durationFromBoot,
    Bundle metadata
)

Creates a new DataPoint of type DataType.ABSOLUTE_ELEVATION with the given meters.

static final @NonNull DataPoint
calories(
    double kcalories,
    @NonNull Duration startDurationFromBoot,
    @NonNull Duration endDurationFromBoot,
    Bundle metadata
)

Creates a new DataPoint of type DataType.TOTAL_CALORIES with the given kcalories.

static final @NonNull DataPoint
dailyCalories(
    double calories,
    @NonNull Duration startDurationFromBoot,
    @NonNull Duration endDurationFromBoot
)

Creates a new DataPoint of type DataType.DAILY_CALORIES with the given calories.

static final @NonNull DataPoint
dailyDistance(
    double distance,
    @NonNull Duration startDurationFromBoot,
    @NonNull Duration endDurationFromBoot
)

Creates a new DataPoint of type DataType.DAILY_DISTANCE with the given distance.

static final @NonNull DataPoint
dailyFloors(
    double floors,
    @NonNull Duration startDurationFromBoot,
    @NonNull Duration endDurationFromBoot
)

Creates a new DataPoint of type DataType.DAILY_FLOORS with the given floors.

static final @NonNull DataPoint
dailySteps(
    long steps,
    @NonNull Duration startDurationFromBoot,
    @NonNull Duration endDurationFromBoot
)

Creates a new DataPoint of type DataType.DAILY_STEPS with the given steps.

static final @NonNull DataPoint
distance(
    double meters,
    @NonNull Duration startDurationFromBoot,
    @NonNull Duration endDurationFromBoot,
    Bundle metadata
)

Creates a new DataPoint of type DataType.DISTANCE with the given meters.

static final @NonNull DataPoint
elevationGain(
    double meters,
    @NonNull Duration startDurationFromBoot,
    @NonNull Duration endDurationFromBoot,
    Bundle metadata
)

Creates a new DataPoint of type DataType.ELEVATION_GAIN with the given meters.

static final @NonNull DataPoint
floors(
    double floors,
    @NonNull Duration startDurationFromBoot,
    @NonNull Duration endDurationFromBoot,
    Bundle metadata
)

Creates a new DataPoint of type DataType.FLOORS with the given floors.

static final @Keep @NonNull List<@NonNull DataPoint>

Retrieves the DataPoint s that are contained in the given Intent, if any.

static final boolean

Retrieves whether permissions are granted in this Intent.

static final @NonNull DataPoint
heartRate(
    double bpm,
    @NonNull Duration durationFromBoot,
    HrAccuracy accuracy
)

Creates a new DataPoint of type DataType.HEART_RATE_BPM with the given bpm and accuracy.

static final @NonNull DataPoint
location(
    double latitude,
    double longitude,
    double altitude,
    double bearing,
    @NonNull Duration durationFromBoot,
    LocationAccuracy accuracy
)

Creates a new DataPoint of type DataType.LOCATION with the given latitude, longitude, altitude, bearing, and accuracy.

static final @NonNull DataPoint
pace(double millisPerKm, @NonNull Duration durationFromBoot)

Creates a new DataPoint of type DataType.PACE with the given millisPerKm.

static final void
putDataPoints(
    @NonNull Intent intent,
    @NonNull Collection<@NonNull DataPoint> dataPoints
)

Puts the given DataPoint s in the given Intent.

static final void
putPermissionsGranted(@NonNull Intent intent, boolean granted)

Sets whether DataPoint permissions are granted in the given Intent.

static final @NonNull DataPoint
speed(
    double metersPerSecond,
    @NonNull Duration durationFromBoot,
    Bundle metadata
)

Creates a new DataPoint of type DataType.SPEED with the given metersPerSecond.

static final @NonNull DataPoint
steps(
    long steps,
    @NonNull Duration startDurationFromBoot,
    @NonNull Duration endDurationFromBoot,
    Bundle metadata
)

Creates a new DataPoint of type DataType.STEPS with the given steps.

static final @NonNull DataPoint
stepsPerMinute(
    long stepsPerMinute,
    @NonNull Duration startDurationFromBoot
)

Creates a new DataPoint of type DataType.STEPS_PER_MINUTE with the given stepsPerMinute.

static final @NonNull DataPoint
swimmingStrokes(
    long strokes,
    @NonNull Duration startDurationFromBoot,
    @NonNull Duration endDurationFromBoot
)

Creates a new DataPoint of type DataType.SWIMMING_STROKES with the given strokes.

Constants

LOCATION_DATA_POINT_ALTITUDE_INDEX

public static final int LOCATION_DATA_POINT_ALTITUDE_INDEX

When using DataType.LOCATION, the value is represented as double[]. The double value at this index represents the altitude. This value will default to Double.MAX_VALUE if it is not available.

LOCATION_DATA_POINT_BEARING_INDEX

public static final int LOCATION_DATA_POINT_BEARING_INDEX

When using DataType.LOCATION, the value is represented as double[]. The double value at this index represents the bearing. This value will default to Double.MAX_VALUE if it is not available.

LOCATION_DATA_POINT_LATITUDE_INDEX

public static final int LOCATION_DATA_POINT_LATITUDE_INDEX

When using DataType.LOCATION, the value is represented as double[]. The double value at this index represents the latitude.

LOCATION_DATA_POINT_LONGITUDE_INDEX

public static final int LOCATION_DATA_POINT_LONGITUDE_INDEX

When using DataType.LOCATION, the value is represented as double[]. The double value at this index represents the longitude.

Public methods

absoluteElevation

public static final @NonNull DataPoint absoluteElevation(
    double meters,
    @NonNull Duration durationFromBoot,
    Bundle metadata
)

Creates a new DataPoint of type DataType.ABSOLUTE_ELEVATION with the given meters.

calories

public static final @NonNull DataPoint calories(
    double kcalories,
    @NonNull Duration startDurationFromBoot,
    @NonNull Duration endDurationFromBoot,
    Bundle metadata
)

Creates a new DataPoint of type DataType.TOTAL_CALORIES with the given kcalories.

dailyCalories

public static final @NonNull DataPoint dailyCalories(
    double calories,
    @NonNull Duration startDurationFromBoot,
    @NonNull Duration endDurationFromBoot
)

Creates a new DataPoint of type DataType.DAILY_CALORIES with the given calories.

dailyDistance

public static final @NonNull DataPoint dailyDistance(
    double distance,
    @NonNull Duration startDurationFromBoot,
    @NonNull Duration endDurationFromBoot
)

Creates a new DataPoint of type DataType.DAILY_DISTANCE with the given distance.

dailyFloors

public static final @NonNull DataPoint dailyFloors(
    double floors,
    @NonNull Duration startDurationFromBoot,
    @NonNull Duration endDurationFromBoot
)

Creates a new DataPoint of type DataType.DAILY_FLOORS with the given floors.

dailySteps

public static final @NonNull DataPoint dailySteps(
    long steps,
    @NonNull Duration startDurationFromBoot,
    @NonNull Duration endDurationFromBoot
)

Creates a new DataPoint of type DataType.DAILY_STEPS with the given steps.

distance

public static final @NonNull DataPoint distance(
    double meters,
    @NonNull Duration startDurationFromBoot,
    @NonNull Duration endDurationFromBoot,
    Bundle metadata
)

Creates a new DataPoint of type DataType.DISTANCE with the given meters.

elevationGain

public static final @NonNull DataPoint elevationGain(
    double meters,
    @NonNull Duration startDurationFromBoot,
    @NonNull Duration endDurationFromBoot,
    Bundle metadata
)

Creates a new DataPoint of type DataType.ELEVATION_GAIN with the given meters.

floors

public static final @NonNull DataPoint floors(
    double floors,
    @NonNull Duration startDurationFromBoot,
    @NonNull Duration endDurationFromBoot,
    Bundle metadata
)

Creates a new DataPoint of type DataType.FLOORS with the given floors.

getDataPoints

@Keep
public static final @NonNull List<@NonNull DataPointgetDataPoints(@NonNull Intent intent)

Retrieves the DataPoint s that are contained in the given Intent, if any.

getPermissionsGranted

public static final boolean getPermissionsGranted(@NonNull Intent intent)

Retrieves whether permissions are granted in this Intent.

heartRate

public static final @NonNull DataPoint heartRate(
    double bpm,
    @NonNull Duration durationFromBoot,
    HrAccuracy accuracy
)

Creates a new DataPoint of type DataType.HEART_RATE_BPM with the given bpm and accuracy.

location

public static final @NonNull DataPoint location(
    double latitude,
    double longitude,
    double altitude,
    double bearing,
    @NonNull Duration durationFromBoot,
    LocationAccuracy accuracy
)

Creates a new DataPoint of type DataType.LOCATION with the given latitude, longitude, altitude, bearing, and accuracy.

pace

public static final @NonNull DataPoint pace(double millisPerKm, @NonNull Duration durationFromBoot)

Creates a new DataPoint of type DataType.PACE with the given millisPerKm.

putDataPoints

public static final void putDataPoints(
    @NonNull Intent intent,
    @NonNull Collection<@NonNull DataPoint> dataPoints
)

Puts the given DataPoint s in the given Intent.

putPermissionsGranted

public static final void putPermissionsGranted(@NonNull Intent intent, boolean granted)

Sets whether DataPoint permissions are granted in the given Intent.

speed

public static final @NonNull DataPoint speed(
    double metersPerSecond,
    @NonNull Duration durationFromBoot,
    Bundle metadata
)

Creates a new DataPoint of type DataType.SPEED with the given metersPerSecond.

steps

public static final @NonNull DataPoint steps(
    long steps,
    @NonNull Duration startDurationFromBoot,
    @NonNull Duration endDurationFromBoot,
    Bundle metadata
)

Creates a new DataPoint of type DataType.STEPS with the given steps.

stepsPerMinute

public static final @NonNull DataPoint stepsPerMinute(
    long stepsPerMinute,
    @NonNull Duration startDurationFromBoot
)

Creates a new DataPoint of type DataType.STEPS_PER_MINUTE with the given stepsPerMinute.

swimmingStrokes

public static final @NonNull DataPoint swimmingStrokes(
    long strokes,
    @NonNull Duration startDurationFromBoot,
    @NonNull Duration endDurationFromBoot
)

Creates a new DataPoint of type DataType.SWIMMING_STROKES with the given strokes.