DataPoints

object DataPoints


Helper class to facilitate working with DataPoint s.

Summary

Constants

final static int

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

final static int

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

final static int

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

Public methods

static final @NonNull DataPoint
aggregateCalories(
    double kcalories,
    @NonNull Duration startDurationFromBoot,
    @NonNull Duration endDurationFromBoot
)

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

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

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

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

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

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

Creates a new DataPoint of type DataType.AGGREGATE_SWIMMING_STROKE_COUNT with the given swimmingStrokes.

static final @NonNull DataPoint
altitude(double meters, @NonNull Duration durationFromBoot)

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

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

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

static final @NonNull DataPoint
averageSpeed(double metersPerSecond, @NonNull Duration durationFromBoot)

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

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

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

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

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

static final @NonNull DataPoint
elevation(
    double meters,
    @NonNull Duration startDurationFromBoot,
    @NonNull Duration endDurationFromBoot
)

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

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

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)

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

static final @NonNull DataPoint
location(
    double latitude,
    double longitude,
    @NonNull Duration durationFromBoot
)

Creates a new DataPoint of type DataType.LOCATION with the given latitude and longitude.

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

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

static final @NonNull DataPoint
maxSpeed(double metersPerSecond, @NonNull Duration durationFromBoot)

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

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)

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

static final @NonNull DataPoint
spo2(double percent, @NonNull Duration durationFromBoot)

Creates a new DataPoint of type DataType.SPO2 with the given percent.

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

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

Constants

LOCATION_DATA_POINT_ALTITUDE_INDEX

@NonNull
public final static 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 is an optional index and there is no guarantee that this index will be present.

LOCATION_DATA_POINT_LATITUDE_INDEX

@NonNull
public final static 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

@NonNull
public final static 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

aggregateCalories

@NonNull
public static final DataPoint aggregateCalories(
    double kcalories,
    @NonNull Duration startDurationFromBoot,
    @NonNull Duration endDurationFromBoot
)

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

aggregateDistance

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

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

aggregateSteps

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

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

aggregateSwimmingStrokes

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

Creates a new DataPoint of type DataType.AGGREGATE_SWIMMING_STROKE_COUNT with the given swimmingStrokes.

altitude

@NonNull
public static final DataPoint altitude(double meters, @NonNull Duration durationFromBoot)

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

averagePace

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

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

averageSpeed

@NonNull
public static final DataPoint averageSpeed(double metersPerSecond, @NonNull Duration durationFromBoot)

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

calories

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

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

distance

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

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

elevation

@NonNull
public static final DataPoint elevation(
    double meters,
    @NonNull Duration startDurationFromBoot,
    @NonNull Duration endDurationFromBoot
)

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

floors

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

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

getDataPoints

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

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

getPermissionsGranted

@NonNull
public static final boolean getPermissionsGranted(@NonNull Intent intent)

Retrieves whether permissions are granted in this Intent.

heartRate

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

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

location

@NonNull
public static final DataPoint location(
    double latitude,
    double longitude,
    @NonNull Duration durationFromBoot
)

Creates a new DataPoint of type DataType.LOCATION with the given latitude and longitude.

location

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

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

maxSpeed

@NonNull
public static final DataPoint maxSpeed(double metersPerSecond, @NonNull Duration durationFromBoot)

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

pace

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

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

putDataPoints

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

Puts the given DataPoint s in the given Intent.

putPermissionsGranted

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

Sets whether DataPoint permissions are granted in the given Intent.

speed

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

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

spo2

@NonNull
public static final DataPoint spo2(double percent, @NonNull Duration durationFromBoot)

Creates a new DataPoint of type DataType.SPO2 with the given percent.

steps

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

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

stepsPerMinute

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

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

swimmingStrokes

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

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