目录

ActivityRecordInsertOptions

Class Info

public class ActivityRecordInsertOptions

Request parameter class for inserting an activity record, including the associated sample set and sampling points to the platform.

The sample code for inserting an activity record is as follows:
Java
// Note that startTime and endTime respectively indicate the start time and end time of the activity record to be inserted. You can define them by yourself.
ActivityRecord activityRecord = new ActivityRecord.Builder()
    .setName("AddActivityRecord")
    .setDesc("This is ActivityRecord add test!")
    .setId("MyAddActivityRecordId")
    .setActivityTypeId(HiHealthActivities.RUNNING)
    .setStartTime(startTime, TimeUnit.MILLISECONDS)
    .setEndTime(endTime, TimeUnit.MILLISECONDS)
    .build();
ActivityRecordInsertOptions insertOption = new ActivityRecordInsertOptions.Builder()
    .setActivityRecord(activityRecord)
    .build();
Kotlin
// Note that startTime and endTime respectively indicate the start time and end time of the activity record to be inserted. You can define them by yourself.
val activityRecord = ActivityRecord.Builder()
    .setName("AddActivityRecord")
    .setDesc("This is ActivityRecord add test!")
    .setId("MyAddActivityRecordId")
    .setActivityTypeId(HiHealthActivities.RUNNING)
    .setStartTime(startTime, TimeUnit.MILLISECONDS)
    .setEndTime(endTime, TimeUnit.MILLISECONDS)
    .build()
val insertRequest = ActivityRecordInsertOptions.Builder().setActivityRecord(activityRecord).build()

Nested Class Summary

Qualifier and Type

Class Name and Description

public static class

ActivityRecordInsertOptions.Builder

Builder for ActivityRecordInsertOptions.

Public Method Summary

Qualifier and Type

Method Name and Description

ActivityRecord

getActivityRecord()

Obtains the activity record to be inserted.

List<SampleSet>

getSampleSets()

Obtains the sample sets to be inserted.

Public Methods

[h2]getActivityRecord()

Method

public ActivityRecord getActivityRecord()

Obtains the activity record to be inserted.

Returns

Type

Description

ActivityRecord

Activity record to be inserted.

[h2]getSampleSets()

Method

public final List<SampleSet> getSampleSets()

Obtains the sample sets to be inserted.

Returns

Type

Description

List<SampleSet>

List of sample sets to be inserted.