com.samsung.android.sdk.healthdata
Class HealthDataResolver.UpdateRequest.Builder
- java.lang.Object
-
- com.samsung.android.sdk.healthdata.HealthDataResolver.UpdateRequest.Builder
-
- Enclosing interface:
- HealthDataResolver.UpdateRequest
public static class HealthDataResolver.UpdateRequest.Builder extends Object
This class is a builder to configureHealthDataResolver.UpdateRequest
. Only inserted health data by your application can be updated. The following example shows how to update calrories of existing health data.public class HealthDataResolverExample { private HealthDataResolver.UpdateRequest buildUpdateRequest() { HealthDevice myDevice = new HealthDeviceManager(mStore).getLocalDevice(); HealthData data = new HealthData(); data.setSourceDevice(myDevice.getUuid()); data.putFloat(HealthConstants.Nutrition.CALORIE, 100); HealthDataResolver.Filter filter = HealthDataResolver.Filter.eq(HealthConstants.Nutrition.CALORIE, 10000); // Build a request to update nutrition data which its calories is 10000 to 100 HealthDataResolver.UpdateRequest request = new HealthDataResolver.UpdateRequest.Builder() .setDataType(HealthConstants.Nutrition.HEALTH_DATA_TYPE) .setFilter(filter) .setHealthData(data) .build(); return request; } }
- Since:
- 1.0.0
-
-
Constructor Summary
Constructors Constructor and Description Builder()
Helps to construct aHealthDataResolver.UpdateRequest
object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description HealthDataResolver.UpdateRequest
build()
Builds a newHealthDataResolver.UpdateRequest
object.HealthDataResolver.UpdateRequest.Builder
setDataType(String type)
Sets a health data type to update.HealthDataResolver.UpdateRequest.Builder
setFilter(HealthDataResolver.Filter filter)
Sets a filter for health data to update.HealthDataResolver.UpdateRequest.Builder
setHealthData(HealthData object)
Sets a health data object to update.HealthDataResolver.UpdateRequest.Builder
setLocalTimeRange(String timeProperty, String offsetProperty, long begin, long end)
Sets the local time range not to miss data from the query's result when there exist data with a differentTIME_OFFSET
in the saved health data.HealthDataResolver.UpdateRequest.Builder
setSourceDevices(List<String> uuidList)
Sets a UUID list of source devices for health data to be updated.
-
-
-
Constructor Detail
-
Builder
public Builder()
Helps to construct aHealthDataResolver.UpdateRequest
object.- Since:
- 1.0.0
-
-
Method Detail
-
setDataType
public HealthDataResolver.UpdateRequest.Builder setDataType(String type)
Sets a health data type to update. It has to be specified before callingbuild()
.- Parameters:
type
-HEALTH_DATA_TYPE
of the data type- Returns:
- The object that applies the health data type
- Since:
- 1.0.0
-
setHealthData
public HealthDataResolver.UpdateRequest.Builder setHealthData(HealthData object)
Sets a health data object to update. It has to be specified before callingbuild()
.- Parameters:
object
- The health data object to update. The source device ofobject
should be valid.- Returns:
- The object that applies health data to update
- Since:
- 1.0.0
-
setFilter
public HealthDataResolver.UpdateRequest.Builder setFilter(HealthDataResolver.Filter filter)
Sets a filter for health data to update.- Parameters:
filter
- The filter object to update- Returns:
- The object that applies the
filter
- Since:
- 1.0.0
-
setSourceDevices
public HealthDataResolver.UpdateRequest.Builder setSourceDevices(List<String> uuidList)
Sets a UUID list of source devices for health data to be updated.- Parameters:
uuidList
- The UUID list for source devices- Returns:
- The object that applies source devices
- Since:
- 1.0.0
-
setLocalTimeRange
public HealthDataResolver.UpdateRequest.Builder setLocalTimeRange(String timeProperty, String offsetProperty, long begin, long end)
Sets the local time range not to miss data from the query's result when there exist data with a differentTIME_OFFSET
in the saved health data.
The data that has a different
TIME_OFFSET
with other data'sTIME_OFFSET
can be saved when the daylight time is applied or the user moves to another region by like a travel. Building a complete query to aggregate all data including the differentTIME_OFFSET
is not easy.
Use this API to build an aggregate request as possible.- Parameters:
timeProperty
- The time property name that needs to add a filteroffsetProperty
- The time offset propertybegin
- The beginning time withGMT+0
milliseconds.
E.g. If you would like to update data from00:00:00
on October 26th, 2021 in your region, set the value with1635206400000
.
See sample codes.
Its minimum value isLong.MIN_VALUE
.end
- The end time withGMT+0
milliseconds.
E.g. If you would like to update data until00:00:00
on October 26th, 2021 in your region, set the value with1635206400000
.
See sample codes.
Its maximum value isLong.MAX_VALUE
.- Returns:
- The object that applies the local time range
- Since:
- 1.5.0
-
build
public HealthDataResolver.UpdateRequest build()
Builds a newHealthDataResolver.UpdateRequest
object. Check if following information is specified.- Data type
- Health data to update
- Returns:
- The
HealthDataResolver.UpdateRequest
object - Throws:
IllegalStateException
- If data type, or health data object is not specified- Since:
- 1.0.0
- See Also:
setDataType(String)
,setHealthData(HealthData)
-
-