HealthConstants.StepDailyTrend
overviewpackageclasstreedeprecatedindex com samsung android sdk healthdata interface healthconstants stepdailytrend all superinterfaces healthconstants common enclosing class healthconstants public static interface healthconstants stepdailytrend extends healthconstants common this interface defines the user's daily step count trend data getting all steps the daily step count trend gives summarized step count data in a day it's a common case that the user has a phone and an accessory like a galaxy watch sometimes the user can carry the phone and the accessory both or he/she can carry only one device for other times if the user carried 'phone' and 'watch' both as 1 and 4 sessions, both devices provide step count data separately their steps are saved with healthconstants stepcount in samsung health reading healthconstants stepcount of 1 and 4 sessions will give more step count than the user's real steps because the query's result includes duplicated steps of 'phone' and 'watch' but removing duplications is not easy with a manual handling healthconstants stepdailytrend provides a simple way to get the user's all steps without duplications just set a filter for source_type with source_type_all with a reading query // state of connection private healthdatastore mstore; // resolver instance private final healthdataresolver mresolver; public static long gettodaystartutctime { calendar today = calendar getinstance timezone gettimezone "utc" ; today set calendar hour_of_day, 0 ; today set calendar minute, 0 ; today set calendar second, 0 ; today set calendar millisecond, 0 ; return today gettimeinmillis ; } public void readtodaystepcountdata { // suppose that the required permission has been acquired already // create a filter for today's steps from all source devices filter filter = filter and filter eq stepdailytrend day_time, gettodaystartutctime , filter eq stepdailytrend source_type, stepdailytrend source_type_all ; readrequest request = new readrequest builder // set the data type setdatatype stepdailytrend health_data_type // set a filter setfilter filter // build build ; mresolver = new healthdataresolver store, null ; try { mresolver read request setresultlistener result -> { long daytime = 0; int totalcount = 0; try { iterator iterator = result iterator ; if iterator hasnext { healthdata data = iterator next ; daytime = data getlong stepdailytrend day_time totalcount = data getint stepdailytrend count ; } } finally { result close ; } } ; } catch exception e { log e mainactivity app_tag, e getclass getname + " - " + e getmessage ; } } stepdailytrend data's creation and update the user's steps are collected through a phone or connected accessories like a watch stepdailytrend data is created after the user's steps are detected the created stepdailytrend data is updated every minutes usually one minute if a step count is changed a number of stepdailytrend data is one for each source_type in a day if the source type collects steps especially source_type_all data exists always if other source_type data is created properties properties of the following extending interfaces are available for this data type healthconstants common step daily trend data has the following properties see more common properties by spreading this section out property name description healthconstants stepdailytrend uuid [mandatory] data's unique id, assigned by the system when a new data is inserted healthconstants stepdailytrend create_time [mandatory] utc milliseconds when a data is created in the health data store, assigned by the system when a new data is inserted healthconstants stepdailytrend update_time [mandatory] utc milliseconds when a data is updated in the health data store, assigned by the system when a new data is inserted or the existing data is updated healthconstants stepdailytrend package_name [mandatory] package name which provides data, assigned by the system when a new data is inserted healthconstants stepdailytrend device_uuid [mandatory] device identifier which provides the health data healthconstants stepdailytrend day_time [mandatory] the date of summarized step count data in milliseconds it indicates 00 00 00 utc of the date exactly, healthconstants stepdailytrend count [mandatory] total number of daily steps healthconstants stepdailytrend binning_data gathering data of the daily step count for every 10 minutes with the json format healthconstants stepdailytrend calorie total burned calories for daily steps in kilocalories healthconstants stepdailytrend distance total distance for daily steps in meters healthconstants stepdailytrend source_pkg_name package name that provides step count data healthconstants stepdailytrend source_type kind of devices healthconstants stepdailytrend speed average speed of daily steps in meters per second data permission the user's consent is required to read or write this data type healthpermissionmanager requestpermissions displays a data permission ui to the user see permission manager and request data permission since 1 5 0 field summary fields modifier and type field and description static string binning_data a set of step count data for every 10 minutes with the json format static string calorie total burned calories for daily steps in kilocalories static string count total number of daily steps static string day_time the date of summarized step count data in milliseconds static string distance total distance for daily steps in meters static string health_data_type data type name for step daily trend data static string source_pkg_name package name that provides step count data static string source_type kind of data sources like a connected accessory device static int source_type_all all data sources, including partner apps only local device phone connected accessory devices like galaxy watch or activity trackers samsung health creates one stepdailytrend data record for each source_type everyday static int source_type_partner_app each partner app static int source_type_phone_only phone only static string speed average speed of daily steps in meters per second fields inherited from interface com samsung android sdk healthdata healthconstants common create_time, custom, device_uuid, package_name, update_time, uuid field detail day_time static final string day_time the date of summarized step count data in milliseconds it indicates 00 00 00 utc of the date exactly mandatory type long since 1 5 0 see also constant field values count static final string count total number of daily steps mandatory type int since 1 5 0 see also constant field values binning_data static final string binning_data a set of step count data for every 10 minutes with the json format it provides maximum 144 data, 6 in an hour * 24 hours count gives just a total step count you can use this info to track more detailed step activity optional type byte[] it is zip compressed as the json format with the following keys json key type "count" int "calorie" float "distance" float "speed" float when you request to read daily step count data, samsung health gives the result as compressed zip that contains 144 one day = 10 minutes * 6 * 24 hours json formatted data with the time order you can estimate each data's time information by counting the data's order the following example shows one of json formatted data { "count" 75 "calorie" 4 0864094495773315, "distance" 56 0, "speed" 0 001272727269679308 } its use cases are converting data to compressed json getting data from compressed json since 1 5 0 see also healthdatautil, constant field values calorie static final string calorie total burned calories for daily steps in kilocalories optional type float since 1 5 0 see also constant field values distance static final string distance total distance for daily steps in meters optional type float since 1 5 0 see also constant field values source_pkg_name static final string source_pkg_name package name that provides step count data if source_type is source_type_all or source_type_phone_only, this value is com sec android app shealth optional type string since 1 5 0 see also constant field values source_type static final string source_type kind of data sources like a connected accessory device it differs with healthconstants common device_uuid that indicates data's each source device optional type int available values one of the following values source_type_all source_type_partner_app source_type_phone_only since 1 5 0 see also constant field values source_type_all static final int source_type_all all data sources, including partner apps only local device phone connected accessory devices like galaxy watch or activity trackers samsung health creates one stepdailytrend data record for each source_type everyday samsung health checks steps for each source device continuously and updates the data records before the next day's 00 00 00 if there is no step for step_source_type, its data record is not created created data is updated every minutes whenever steps are changed in a day including data for source_type_all since 1 5 0 see also source_type, constant field values source_type_partner_app static final int source_type_partner_app each partner app this source type data is created at the end of every day about 00 00 00 utc if a partner app's step count exists in a day it doesn't provide today's data but until yesterday use healthconstants stepcount for today's phone step data see source_pkg_name to find an wanted partner app since 1 5 0 see also source_type, constant field values source_type_phone_only static final int source_type_phone_only phone only this source type data is created at the end of every day about 00 00 00 utc if the phone's step count exists in a day it doesn't provide today's data but until yesterday use healthconstants stepcount for today's phone step data since 1 5 0 see also source_type, constant field values speed static final string speed average speed of daily steps in meters per second optional type float since 1 5 0 see also constant field values health_data_type static final string health_data_type data type name for step daily trend data use "com samsung shealth step_daily_trend" to add permission to the manifest file since 1 5 0 see also constant field values