目录

ActivityRecord.Builder

Class Info

public static class Builder

Builder for ActivityRecord.

Public Constructor Summary

Constructor Name

Builder()

No-argument builder for the constructor.

Public Method Summary

Qualifier and Type

Method Name and Description

ActivityRecord

build()

Builds and returns the activity record instance.

ActivityRecord.Builder

setActiveTime(long activeTime, TimeUnit timeUnit)

Sets the active time of the activity record based on the passed time unit.

ActivityRecord.Builder

setActivitySummary(ActivitySummary activitySummaryParam)

Sets ActivitySummary based on the passed object.

ActivityRecord.Builder

setActivityTypeId(String activityType)

Sets the activity type associated with the activity record.

ActivityRecord.Builder

setAppInfo(AppInfo appInfo)

Sets the app information of the activity record.

ActivityRecord.Builder

setDesc(String description)

Sets the description of the activity record. The input parameter can be null, an empty string, or a string of 1 to 1000 characters.

ActivityRecord.Builder

setDeviceInfo(DeviceInfo deviceInfo)

Sets the device information of an activity record.

ActivityRecord.Builder

setDurationTime(long time, TimeUnit timeUnit)

Sets the duration of the activity record based on the passed time unit.

ActivityRecord.Builder

setEndTime(long endTime, TimeUnit timeUnit)

Sets the end time of the activity record based on the passed time unit.

ActivityRecord.Builder

setId(String identifier)

Sets the ID of the activity record, which is unique across all activity records owned by the user. The input parameter can be a string of 1 to 1000 characters.

ActivityRecord.Builder

setMetadata(String metadata)

Sets the metadata in the activity record.

ActivityRecord.Builder

setName(String sessionName)

Sets the name of the activity record. The input parameter can be null or a string of 1 to 980 characters.

ActivityRecord.Builder

setStartTime(long startTime, TimeUnit timeUnit)

Sets the start time of the activity record based on the passed time unit.

ActivityRecord.Builder

setTimeZone(String timeZone)

Sets the time zone.

Public Constructors

[h2]Builder()

Constructor

public Builder()

No-argument builder for the constructor.

Public Methods

[h2]build()

Method

public ActivityRecord build()

Builds and returns the activity record.

Returns

Type

Description

ActivityRecord

Activity record.

[h2]setActivityTypeId(String activityType)

Method

public ActivityRecord.Builder setActivityTypeId(String activityType)

Sets the activity type associated with the activity record.

Parameters

Name

Description

activityType

Activity type.

Returns

Type

Description

ActivityRecord.Builder

Builder.

[h2]setDesc(String description)

Method

public ActivityRecord.Builder setDesc(String description)

Sets the description of the activity record.

Parameters

Name

Description

description

Activity description.

Returns

Type

Description

ActivityRecord.Builder

Builder.

[h2]setDeviceInfo(DeviceInfo deviceInfo)

Method

public ActivityRecord.Builder setDeviceInfo(DeviceInfo deviceInfo)

Sets the device information of an activity record.

NOTE:

Health Service Kit does not collect device information. You can pass device information as required. Leaving it empty does not affect the normal use of the SDK.

Parameters

Name

Description

deviceInfo

Device information.

Returns

Type

Description

ActivityRecord.Builder

Builder.

[h2]setDurationTime(long time, TimeUnit timeUnit)

Method

public ActivityRecord.Builder setDurationTime(long time, TimeUnit timeUnit)

Sets the duration of the activity record based on the passed time unit.

Parameters

Name

Description

time

Activity duration.

timeUnit

Time unit.

Returns

Type

Description

ActivityRecord.Builder

Builder.

[h2]setActiveTime(long activeTime, TimeUnit timeUnit)

Method

public ActivityRecord.Builder setActiveTime(long activeTime, TimeUnit timeUnit)

Sets the active time of the activity record based on the passed time unit.

Parameters

Name

Description

activeTime

Active time of an activity record.

timeUnit

Time unit.

Returns

Type

Description

ActivityRecord.Builder

Builder.

[h2]setEndTime(long endTime, TimeUnit timeUnit)

Method

public ActivityRecord.Builder setEndTime(long endTime, TimeUnit timeUnit)

Sets the end time of the activity record based on the passed time unit. If the end time is not specified, the activity record is considered as still being in progress.

The end time must be later than the UNIX timestamp corresponding to 00:00 on January 1, 2014.

Parameters

Name

Description

endTime

End time.

timeUnit

Time unit.

Returns

Type

Description

ActivityRecord.Builder

Builder.

[h2]setId(String identifier)

Method

public ActivityRecord.Builder setId(String identifier)

Sets the ID of the activity record.

Parameters

Name

Description

identifier

ID of the activity record.

Returns

Type

Description

ActivityRecord.Builder

Builder.

[h2]setName(String sessionName)

Method

public ActivityRecord.Builder setName(String sessionName)

Sets the name of the activity record.

Parameters

Name

Description

sessionName

Name of the activity record.

Returns

Type

Description

ActivityRecord.Builder

Builder.

[h2]setStartTime(long startTime, TimeUnit timeUnit)

Method

public ActivityRecord.Builder setStartTime(long startTime, TimeUnit timeUnit)

Sets the start time of the activity record based on the passed time unit.

Parameters

Name

Description

startTime

Start time, as a UNIX timestamp.

NOTE:

The start time must be later than the UNIX timestamp corresponding to 00:00 on January 1, 2014.

timeUnit

Time unit.

Returns

Type

Description

ActivityRecord.Builder

Builder.

[h2]setActivitySummary(ActivitySummary activitySummaryParam)

Method

public ActivityRecord.Builder setActivitySummary(ActivitySummary activitySummaryParam)

Sets ActivitySummary based on the passed object.

Parameters

Name

Description

activitySummaryParam

Activity summary.

Returns

Type

Description

ActivityRecord.Builder

Builder.

[h2]setTimeZone(String timeZone)

Method

public ActivityRecord.Builder setTimeZone(String timeZone)

Sets the time zone.

Parameters

Name

Description

timeZone

Time zone.

Returns

Type

Description

ActivityRecord.Builder

Builder.

[h2]setMetadata(String metadata)

Method

public ActivityRecord.Builder setMetadata(String metadata)

Sets the metadata in the activity record.

Parameters

Name

Description

metadata

Metadata, which can be defined as a character string in JSON format. The value can be null, an empty string, or a string of 1 to 10000 characters.

Returns

Type

Description

ActivityRecord.Builder

Builder.

[h2]setAppInfo(AppInfo appInfo)

Method

public ActivityRecord.Builder setAppInfo(AppInfo appInfo)

Sets the app information of the activity record.

Parameters

Name

Description

appInfo

App information of the activity record.

Returns

Type

Description

ActivityRecord.Builder

Builder.