Filter
-
Content Type
-
Category
Mobile/Wearable
Visual Display
Digital Appliance
Platform
Mobile/Wearable
Visual Display
Digital Appliance
Platform
Filter
Develop Health
docmigration guide from samsung health sdk for android to samsung health data sdk following the release of samsung health data sdk, samsung health sdk for android has been deprecated after this transition, partner apps that currently use samsung health sdk for android need to transition to samsung health data sdk benefits of migrating to samsung health data sdk samsung health data sdk enables apps to access health data in the samsung health app on android smartphones not only does it offer the functionality as samsung health sdk for android, but it also provides various additional advantages compared to samsung health sdk for android, samsung health data sdk applies the service logic displayed in the samsung health app's trackers and provides more specialized data from the app this allows health service providers to gain a better understanding of users' health indicators for example, to retrieve the same step count data displayed in the samsung health app when using samsung health sdk for android, you need to set the data type as stepdailytrend set filters for both the time period source_type_all this ensures that you receive the same step count data that`s displayed in the samsung health app samsung health sdk for android code val healthdataresolver = healthdataresolver healthdatastore, null val date = localdate now atstartofday toinstant zoneoffset utc toepochmilli val filter = filter and filter eq stepdailytrend day_time, date , filter eq stepdailytrend source_type, stepdailytrend source_type_all val stepsrequest = healthdataresolver readrequest builder setdatatype stepdailytrend health_data_type setfilter filter build with samsung health data sdk, you can simplify a data request by utilizing the total aggregator and only applying a time filter this data request allows you to retrieve the daily total step count displayed in the samsung health app without considering the potential oversight of setting the source type to `all' samsung health data sdk code val starttime = localdate now atstartofday val endtime = localdatetime now val localtimefilter = localtimefilter of starttime, endtime val stepsrequest = datatype stepstype total requestbuilder setlocaltimefilter localtimefilter build samsung health data sdk provides various goal data types, such as step goal, sleep goals, and active calories burned goal goal data types help to provide appropriate guidance to users samsung health data sdk can read, write, update, and delete health data in the samsung health app it can also retrieve associated data related to specific data for example, the samsung health app continuously measures blood oxygen and skin temperature during sleep samsung health data sdk allows you to easily retrieve blood oxygen and skin temperature data related to this specific sleep data samsung health sdk for android will remain operational for at least 2 years after its deprecation after a certain period, this sdk will be removed, so we recommend updating your app to use samsung health data sdk instead developer mode previously, samsung health sdk for android required developers to submit a partner request to gain access, which needed to be applied for and approved before use now, with samsung health data sdk, you can download and use the sdk in developer mode without submitting a partner request to enhance convenience for developers, samsung health data sdk has improved its developer mode functionality if you only need to read data from samsung health app, you can activate developer mode and proceed with development and testing without requiring a partner request for more information on developer mode, please refer to developer mode if you want to test writing data to samsung health app using samsung health data sdk or distribute your app, you need to obtain a partnership for samsung health data sdk you can request it by following this process checking supported data types of samsung health data sdk before you start using samsung health data sdk, please, compare it with samsung health sdk for android and its existing data types to determine whether the data types you want to use in your app are supported and what additional data can be utilized category data type of samsung health sdk for android sdk corresponding data type in samsung health data sdk activity healthconstants exercise exercisetype healthconstants floorsclimbed floorsclimbedtype healthconstants stepdailytrend read-only stepstype read-only healthconstants stepcount read-only not provided not provided stepgoaltype read-only not provided activitysummarytype read-only not provided activecaloriesburnedgoaltype read-only not provided activetimegoaltype read-only food intake healthconstants nutrition nutritiontype not provided nutritiongoaltype read-only healthconstants waterintake waterintaketype not provided waterintakegoaltype read-only rest healthconstants sleep sleeptype healthconstants sleepstage not provided not provided sleepgoaltype read-only healthcare healthconstants bloodglucose bloodglucosetype healthconstants bloodpressure bloodpressuretype healthconstants bodytemperature bodytemperature healthconstants heartrate heartratetype healthconstants oxygensaturationtype bloodoxygentype healthconstants weight bodycompositiontype not provided skintemperature score not provided energyscoretype read-only user profile healthuserprofile read-only userprofiledatatype read-only checking the user experience to access health data from samsung health data sdk, you need to receive data permissions and obtain user consent in order to do that, please, follow the same process as samsung health sdk for android you can request data permissions at requesting data permissions notewhen using both sdks together, the data permissions of each sdk are displayed to the user, which can result in an inconvenient ui for the user hence, we recommend to use samsung health data sdk data permission of samsung health sdk for android data permission of samsung health data sdk getting started 1 download samsung health data sdk visit samsung health data sdk page to download samsung health data sdk 2 enabling samsung health data sdk’s developer mode if you only need to read data from samsung health app, you can enable the developer mode feature without submitting an additional partner request refer to the developer mode documentation for instructions on how to enable it if you want to write data to samsung health app, you need to submit a partner request 3 importing samsung health data sdk's library remove the library of samsung health sdk for android from your app project samsung-health-data- version aar and add samsung health data sdk's library to the app/libs folder samsung-health-data-api- version aar 4 update app manifest if your app's manifest has the element for the samsung health app, please remove it remove the element remove the element for samsung health sdk for android from your app manifest <manifest > <queries> <package android name="com sec android app shealth" /> </queries> </manifest> if the app manifest has the element lines related to health data permissions of samsung health sdk for android, please remove it remove the data permission declarations remove the data permission declarations for samsung health sdk for android from your app manifest <manifest > <application > <meta-data android name="com samsung android health permission read" android value="com samsung health exercise;com samsung shealth step_daily_trend"/> <meta-data android name="com samsung android health permission write" </application> </manifest> include migration completion information please add the following information to your app manifest <manifest > <application > <meta-data android name="com samsung android sdk health data migration_completed" android value="true"/> </application> </manifest> 5 gradle settings in the app/builde gradle, remove the dependency for samsung health sdk for android app/build gradle - remove the dependency for samsung health sdk for android dependencies { implementation files 'src/main/libs/samsung-health-data-1 5 1 aar' } add the dependency for samsung health data sdk instead app/build gradle - add the dependency for samsung health data sdk dependencies { implementation filetree mapof "dir" to "libs", "include" to listof "* aar" } add the gson library in the dependency app/build gradle - add the dependency for samsung health data sdk dependencies { implementation "com google code gson gson 2 9 0" } and apply the kotlin-parcelize plugin to the app/build gradle app/build gradle - add the plugin for samsung health data sdk plugins { id "kotlin-parcelize" } 6 connecting with samsung health to access health data in the samsung health app, you need to connect the sdk with the samsung health app if the samsung health app is not installed or you have an earlier version of the samsung health app than the supported version, an exception occurs after the connection request if it is a resolvable exception, call the resolve api is to resolve the exception below is an example code snippet when using samsung health sdk for android connecting with samsung health with samsung health sdk for android lateinit var healthdatastore healthdatastore fun connect activity activity { healthdatastore = healthdatastore context, object healthdatastore connectionlistener { override fun onconnected { log i app_tag, "health data service is connected" } override fun onconnectionfailed error healthconnectionerrorresult { if error hasresolution { error resolve activity } else { log i app_tag, "health data service is not available" } } override fun ondisconnected { log i app_tag, "health data service is disconnected" } } runcatching { healthdatastore connectservice } onfailure { error -> error message? let { log i app_tag, it } } } to connect to the samsung health app using samsung health data sdk, you can do so as shown in the code below connecting with samsung health with samsung health data sdk lateinit var healthdatastore healthdatastore fun connect activity activity { runcatching { healthdatastore = healthdataservice getstore context } onsuccess { log i app_tag, "health data service is connected" } onfailure { error -> if error is resolvableplatformexception && error hasresolution { error resolve activity } // handle other types of healthdataexception error message? let { log i app_tag, it } } } 7 requesting data permissions after you have successfully connected to the samsung health app, you need to request data permissions for the health data you want to access from the user upon obtaining an explicit consent from the user, you will be able to access the health data before requesting data permission, check if the user has already granted the data permission if the required data permission has not been obtained, proceed to request the necessary data permission the following code is an example of requesting data permissions to read daily step count, nutrition, and user profile data when using samsung health sdk for android requesting data permission with samsung health sdk for android private val permissionlistener healthresultholder resultlistener<permissionresult> = healthresultholder resultlistener<permissionresult> { result -> if result resultmap values contains false { log i app_tag, "not all required permissions granted" } else { log i app_tag, "all required permissions granted" } } fun requestpermissions activity activity, healthdatastore healthdatastore { val permissionset = setof permissionkey stepdailytrend health_data_type, healthpermissionmanager permissiontype read , permissionkey nutrition health_data_type, healthpermissionmanager permissiontype read , permissionkey healthconstants user_profile_data_type, healthpermissionmanager permissiontype read val permissionmanager = healthpermissionmanager healthdatastore runcatching { val grantedpermissions = permissionmanager ispermissionacquired permissionset if grantedpermissions values all { it } { log i app_tag, "all required permissions granted" } else { log i app_tag, "not all required permissions granted" permissionmanager requestpermissions permissionset, activity setresultlistener permissionlistener } } onfailure { error -> error message? let { log i app_tag, it } } } when the above code is executed, the following screenshot shows the data permission popup displayed to the user when using samsung health data sdk, you can do the following requesting data permission with samsung health data sdk suspend fun requestpermissions healthdatastore healthdatastore, activity activity { val permissionset = setof permission of datatypes steps, accesstype read , permission of datatypes nutrition, accesstype read , permission of datatypes user_profile, accesstype read val grantedpermissions = healthdatastore getgrantedpermissions permissionset if grantedpermissions containsall permissionset { log i app_tag, "all required permissions granted" } else { healthdatastore requestpermissions permissionset, activity } } when requesting data permissions with samsung health data sdk, the following screenshot will be displayed to the user 8 data request asynchronous request asynchronous operations allow the application to continue processing other tasks without waiting for the current task to complete it prevents the main thread from being blocked it enhances user experience by keeping the application interactive during long-running tasks and supports efficient handling of concurrent operations below you can see a code example of when using samsung health sdk for android to make an asynchronous request asynchronous request when with samsung health sdk for android fun readstepsasync healthdatastore healthdatastore { val healthdataresolver = healthdataresolver healthdatastore, null val date = localdate now atstartofday toinstant zoneoffset utc toepochmilli val filter = filter and filter eq stepdailytrend day_time, date , filter eq stepdailytrend source_type, stepdailytrend source_type_all val stepsrequest = healthdataresolver readrequest builder setdatatype stepdailytrend health_data_type setfilter filter build try { healthdataresolver read stepsrequest setresultlistener { result -> try { val iterator = result iterator if iterator hasnext { val healthdata = iterator next val stepcount = healthdata getint stepdailytrend count log i mainactivity app_tag, "step count $stepcount" } } finally { result close } } } catch exception exception { exception message? let { log i mainactivity app_tag, it } } } when using samsung health data sdk, you can perform the same operation as follows use an api that includes async asynchronous request with samsung health data sdk fun readstepsasync healthdatastore healthdatastore, activity activity { val starttime = localdate now atstartofday val endtime = localdatetime now val localtimefilter = localtimefilter of starttime, endtime val stepsrequest = datatype stepstype total requestbuilder setlocaltimefilter localtimefilter build healthdatastore aggregatedataasync stepsrequest setcallback looper getmainlooper , { result -> val stepcount = result datalist first value log i mainactivity app_tag, "step count $stepcount" } { error -> if error is resolvableplatformexception && error hasresolution { error resolve activity } } } synchronous request synchronous operations execute tasks sequentially, requiring the application to wait for the current task to complete before proceeding to the next while this approach is simple to implement and ensures a predictable execution flow, it can block the main thread this makes synchronous operations more suitable for straightforward, short tasks rather than complex or concurrent processes to perform synchronous operations when using samsung health sdk for android, you can use the await api synchronous request with samsung health sdk for android fun readstepssync healthdatastore healthdatastore { val healthdataresolver = healthdataresolver healthdatastore, null val date = localdate now atstartofday toinstant zoneoffset utc toepochmilli val filter = filter and filter eq stepdailytrend day_time, date , filter eq stepdailytrend source_type, stepdailytrend source_type_all val stepsrequest = healthdataresolver readrequest builder setdatatype stepdailytrend health_data_type setfilter filter build try { healthdataresolver read stepsrequest await run { try { val iterator = iterator if iterator hasnext { val healthdata = iterator next val stepcount = healthdata getint stepdailytrend count log i mainactivity app_tag, "step count $stepcount" } } finally { close } } } catch exception exception { exception message? let { log i mainactivity app_tag, it } } } for synchronous operations involving samsung health data sdk, please, use the following approach synchronous request with samsung health data sdk suspend fun readstepssync healthdatastore healthdatastore { val starttime = localdate now atstartofday val endtime = localdatetime now val stepsrequest = datatype stepstype total requestbuilder setlocaltimefilterwithgroup localtimefilter companion of starttime, endtime , localtimegroup of localtimegroupunit hourly, 1 build try { val readresult = healthdatastore aggregatedata stepsrequest val stepcount = readresult datalist first value log i mainactivity app_tag, "step count $stepcount" } catch e exception { e printstacktrace } } 9 implementing and testing app accessing the health data is required by the app to test to ensure the functionality works properly for detailed information on accessing health data, refer to accessing health data 10 partner request before distributing your app the developer mode of samsung health data sdk is a feature provided solely for development purposes to ensure that an app using samsung health data sdk functions properly without enabling developer mode, you need to submit a partner request through the developer site before distributing your app on app marketplaces after the partner app is approved, the app's detailed information will be registered in samsung's system accessing health data steps samsung health measures step data from smartphones with samsung health installed and from connected galaxy wearable devices, such as the galaxy watch, galaxy fit, or galaxy ring it aggregates and eliminates duplicate data to provide daily step counts step count data is read-only the corresponding steps data types in samsung health sdk for android and samsung health data sdk are as following samsung health sdk for android samsung health data sdk healthconstants stepdailytrend read-only healthconstants stepcount read-only stepstype read-only here is an example of code that reads today's total step count when using samsung health sdk for android reading today's total steps with samsung health sdk for android fun readtodaystepcountdata healthdatastore healthdatastore { val starttime = localdate now atstartofday toinstant zoneoffset utc toepochmilli val filter = filter and filter eq stepdailytrend day_time, starttime , filter eq stepdailytrend source_type, stepdailytrend source_type_all val healthdataresolver = healthdataresolver healthdatastore, null val request = healthdataresolver readrequest builder setdatatype stepdailytrend health_data_type setfilter filter build try { healthdataresolver read request setresultlistener { result -> try { val iterator = result iterator if iterator hasnext { val healthdata = iterator next val totalcount = healthdata getint stepdailytrend count log i mainactivity app_tag, "today steps count $totalcount" } else { log i mainactivity app_tag, "no step data available" the code to retrieve today's total step count when using samsung health data sdk is as follows reading today's total steps with samsung health data sdk suspend fun readtodaystepcountdata healthdatastore healthdatastore { val starttime = localdate now atstartofday val endtime = localdatetime now val readrequest = datatype stepstype total requestbuilder setlocaltimefilter localtimefilter of starttime, endtime build try { val readresult = healthdatastore aggregatedata readrequest val data = readresult datalist first val totalcount = data value log i mainactivity app_tag, "today steps count $totalcount" } catch e exception { e printstacktrace } } exercise the samsung health app records the user's exercise data when the user wears a galaxy watch, galaxy fit, or galaxy ring and records exercise data, the app records their heart rate, exercise speed, and distance the corresponding exercise data types in samsung health sdk for android and samsung health data sdk are as following samsung health sdk for android samsung health data sdk healthconstants exercise exercisetype example code for reading today's exercise data when using samsung health sdk for android is as follows reading exercise data with samsung health sdk for android fun readtodayexercise healthdatastore healthdatastore { val starttime = localdate now atstartofday toinstant zoneoffset utc toepochmilli val endtime = localdate now plusdays 1 atstartofday toinstant zoneoffset utc toepochmilli val healthdataresolver = healthdataresolver healthdatastore, null val readrequest = healthdataresolver readrequest builder setdatatype exercise health_data_type setlocaltimerange floorsclimbed start_time, floorsclimbed time_offset, starttime, endtime build try { healthdataresolver read readrequest setresultlistener { result -> try { val iterator = result iterator iterator foreach { healthdata -> val exercisetype = healthdata getint exercise exercise_type val duration = healthdata getlong exercise duration val calories = healthdata getfloat exercise calorie log i mainactivity app_tag, "exercise type $exercisetype, duration $duration, calories $calories" } } finally { result close } } } catch exception exception { exception message? let { log i mainactivity app_tag, it } } } example code for reading today's exercise data when using samsung health data sdk is as follows reading exercise data with samsung health data sdk suspend fun readtodayexercise healthdatastore healthdatastore { val starttime = localdate now atstartofday val endtime = localdatetime now val readrequest = datatypes exercise readdatarequestbuilder setlocaltimefilter localtimefilter of starttime, endtime build try { val readresult = healthdatastore readdata readrequest val datapoints = readresult datalist if datapoints isempty { log i mainactivity app_tag, "no exercises today" return } datapoints foreach { datapoint -> val exercisetype = datapoint getvalue datatype exercisetype exercise_type val sessions = datapoint getvalue datatype exercisetype sessions sessions? foreach { session -> val exercisesessiontype = session exercisetype val exercisesessionduration = session duration val exercisesessioncalories = session calories log i mainactivity app_tag, "exercise type $exercisetype, session type $exercisesessiontype, duration $exercisesessionduration, calories $exercisesessioncalories" } } } catch e exception { e printstacktrace } } example code for writing exercise data when using samsung health sdk for android is as follows writing running exercise data with samsung health sdk for android fun insertrunningexercise healthdatastore healthdatastore { val fiveminutesasseconds = 300l val exercisetype = 1002 val calories = 73f val distance = 1000f val deviceid = healthdevicemanager healthdatastore localdevice uuid val starttime = instant now minusseconds fiveminutesasseconds val endtime = instant now val timeoffset = timezone getdefault getoffset endtime toepochmilli tolong val duration = duration between starttime, endtime val healthdataresolver = healthdataresolver healthdatastore, null val livedata = createlivedata listof exerciselivedata start_time = starttime toepochmilli , heart_rate = 144f, speed = 1 6f , exerciselivedata start_time = starttime plusseconds 30 toepochmilli , heart_rate = 146f, speed = 1 8f , exerciselivedata start_time = starttime plusseconds 60 toepochmilli , heart_rate = 146f, speed = 1 9f , exerciselivedata start_time = starttime plusseconds 90 toepochmilli , heart_rate = 152f, speed = 2f , exerciselivedata start_time = starttime plusseconds 120 toepochmilli , heart_rate = 154f, speed = 2 1f , exerciselivedata start_time = starttime plusseconds 150 toepochmilli , heart_rate = 161f, speed = 2 2f , exerciselivedata start_time = starttime plusseconds 180 toepochmilli , heart_rate = 159f, speed = 2 1f , exerciselivedata start_time = starttime plusseconds 210 toepochmilli , heart_rate = 160f, speed = 2 2f , exerciselivedata start_time = starttime plusseconds 240 toepochmilli , heart_rate = 159f, speed = 2 1f , exerciselivedata start_time = starttime plusseconds 270 toepochmilli , heart_rate = 161f, speed = 2 2f , exerciselivedata start_time = starttime plusseconds 300 toepochmilli , heart_rate = 160f, speed = 2f val healthdata = healthdata apply { sourcedevice = deviceid putlong exercise start_time, starttime toepochmilli putlong exercise end_time, endtime toepochmilli putlong exercise time_offset, timeoffset putint exercise exercise_type, exercisetype putlong exercise duration, duration tomillis putfloat exercise calorie, calories putfloat exercise distance, distance putblob exercise live_data, livedata } val insertrequest = healthdataresolver insertrequest builder setdatatype exercise health_data_type build insertrequest addhealthdata healthdata try { val result = healthdataresolver insert insertrequest await if result status == status_successful { log i mainactivity app_tag, "inserted running exercise count of data ${result count}" } else { log i mainactivity app_tag, "inserting failed" } } catch e exception { e printstacktrace } } private fun createlivedata livedatalist list<exerciselivedata> bytearray { val zip = healthdatautil getjsonblob livedatalist return zip } data class exerciselivedata val start_time long, val heart_rate float, val speed float example code for writing exercise data when using samsung health data sdk is as follows one exercise session of exercise data is writable writing running exercise data with samsung health data sdk suspend fun insertrunningexercise healthdatastore healthdatastore { val fiveminutesasseconds = 300l val calories = 73f val distance = 1000f val starttime = instant now minusseconds fiveminutesasseconds val endtime = instant now val duration = duration between starttime, endtime val exerciselog = listof exerciselog of timestamp = starttime, heartrate = 144f, speed = 1 6f, cadence = null, count = null, power = null , exerciselog of timestamp = starttime plusseconds 30 , heartrate = 146f, speed = 1 8f, cadence = null, count = null, power = null , exerciselog of timestamp = starttime plusseconds 60 , heartrate = 146f, speed = 1 9f, cadence = null, count = null, power = null , exerciselog of timestamp = starttime plusseconds 90 , heartrate = 152f, speed = 2f, cadence = null, count = null, power = null , exerciselog of timestamp = starttime plusseconds 120 , heartrate = 154f, speed = 2 1f, cadence = null, count = null, power = null , exerciselog of timestamp = starttime plusseconds 150 , heartrate = 161f, speed = 2 2f, cadence = null, count = null, power = null , exerciselog of timestamp = starttime plusseconds 180 , heartrate = 159f, speed = 2 1f, cadence = null, count = null, power = null , exerciselog of timestamp = starttime plusseconds 210 , heartrate = 160f, speed = 2 2f, cadence = null, count = null, power = null , exerciselog of timestamp = starttime plusseconds 240 , heartrate = 159f, speed = 2 1f, cadence = null, count = null, power = null , exerciselog of timestamp = starttime plusseconds 270 , heartrate = 161f, speed = 2 2f, cadence = null, count = null, power = null , exerciselog of timestamp = starttime plusseconds 300 , heartrate = 160f, speed = 2f, cadence = null, count = null, power = null try { val session = exercisesession builder setstarttime starttime setendtime endtime setexercisetype datatype exercisetype predefinedexercisetype running setduration duration setcalories calories setdistance distance setlog exerciselog build val healthdatapoint = healthdatapoint builder setstarttime starttime setendtime endtime addfielddata datatype exercisetype exercise_type, datatype exercisetype predefinedexercisetype running addfielddata datatype exercisetype sessions, listof session build val insertrequest = datatypes exercise insertdatarequestbuilder adddata healthdatapoint build healthdatastore insertdata insertrequest log i mainactivity app_tag, "inserted running exercise" } catch e exception { e printstacktrace } } floors climbed floors climbed data is one of the activity health data types it is displayed in the activity tracker in the samsung health app the corresponding floors climbed data types in samsung health sdk for android and samsung health data sdk are as following samsung health sdk for android samsung health data sdk healthconstants floorsclimbed floorsclimbedtype to read today's floors climbed data when using samsung health sdk for android, the following example code can be used reading floors climbed data with samsung health sdk for android fun readtodayfloorsclimbed healthdatastore healthdatastore { val starttime = localdate now atstartofday toinstant zoneoffset utc toepochmilli val endtime = localdate now plusdays 1 atstartofday toinstant zoneoffset utc toepochmilli val healthdataresolver = healthdataresolver healthdatastore, null val readrequest = healthdataresolver readrequest builder setdatatype floorsclimbed health_data_type setlocaltimerange floorsclimbed start_time, floorsclimbed time_offset, starttime, endtime build try { healthdataresolver read readrequest setresultlistener { result -> try { val iterator = result iterator if iterator hasnext { val healthdata = iterator next val totalcount = healthdata getfloat floorsclimbed floor log i mainactivity app_tag, "today floors climbed $totalcount" } else { log i mainactivity app_tag, "today floors climbed 0" } } finally { result close } } } catch exception exception { exception message? let { log i mainactivity app_tag, it } } } when using samsung health data sdk to read today's floors climbed data is as follows reading floors climbed data with samsung health data sdk suspend fun readtodayfloorsclimbed healthdatastore healthdatastore { val starttime = localdate now atstartofday val endtime = localdatetime now val readrequest = datatype floorsclimbedtype total requestbuilder setlocaltimefilter localtimefilter of starttime, endtime build try { val readresult = healthdatastore aggregatedata readrequest val data = readresult datalist val totalcount = if data isnotempty data first value else 0 log i mainactivity app_tag, "today floors climbed $totalcount" } catch e exception { e printstacktrace } } to write floors climbed data when using samsung health sdk for android, the following example code can be used writing floors climbed data with samsung health sdk for android fun inserttodayfloorsclimbed healthdatastore healthdatastore { val oneminuteasseconds = 60l val floor = 2f val deviceid = healthdevicemanager healthdatastore localdevice uuid val starttime = instant now minusseconds oneminuteasseconds toepochmilli val endtime = instant now toepochmilli val timeoffset = timezone getdefault getoffset endtime tolong val healthdataresolver = healthdataresolver healthdatastore, null val healthdata = healthdata apply { sourcedevice = deviceid putlong floorsclimbed start_time, starttime putlong floorsclimbed end_time, endtime putlong floorsclimbed time_offset, timeoffset putfloat floorsclimbed floor, floor } val insertrequest = healthdataresolver insertrequest builder setdatatype floorsclimbed health_data_type build insertrequest addhealthdata healthdata try { val result = healthdataresolver insert insertrequest await if result status == status_successful { log i mainactivity app_tag, "inserted floor climbed count of data ${result count}" } else { log i mainactivity app_tag, "inserting failed" } } catch e exception { e printstacktrace } } when using samsung health data sdk to write today's floors climbed data is as follows writing floors climbed data with samsung health data sdk suspend fun inserttodayfloorclimbed healthdatastore healthdatastore { val oneminuteasseconds = 60l val floor = 2f val starttime = instant now minusseconds oneminuteasseconds val endtime = instant now try { val healthdatapoint = healthdatapoint builder setstarttime starttime setendtime endtime addfielddata datatype floorsclimbedtype floor, floor build val insertrequest = datatypes floors_climbed insertdatarequestbuilder adddata healthdatapoint build healthdatastore insertdata insertrequest log i mainactivity app_tag, "inserted floor climbed" } catch e exception { e printstacktrace } } nutrition the samsung health app provides a food tracker that allows users to record and manage their eating data for each meal type, such as breakfast, lunch, and dinner the corresponding nutrition data types in samsung health sdk for android and samsung health data sdk are as following samsung health sdk for android samsung health data sdk healthconstants nutrition nutritiontype here is an example code to read today's nutrition data when using samsung health sdk for android reading nutrition data with samsung health sdk for android fun readtodaynutrition healthdatastore healthdatastore { val starttime = localdate now atstartofday toinstant zoneoffset utc toepochmilli val endtime = localdate now plusdays 1 atstartofday toinstant zoneoffset utc toepochmilli val healthdataresolver = healthdataresolver healthdatastore, null val nutritionrequest = healthdataresolver readrequest builder setdatatype nutrition health_data_type setlocaltimerange nutrition start_time, nutrition time_offset, starttime, endtime build try { healthdataresolver read nutritionrequest setresultlistener { result -> try { val iterator = result iterator iterator foreach { healthdata -> val title = healthdata getstring nutrition title val mealtype = healthdata getint nutrition meal_type val calories = healthdata getfloat nutrition calorie log i mainactivity app_tag, "today nutrition $title, $mealtype, $calories" } } finally { result close } } } catch exception exception { exception message? let { log i mainactivity app_tag, it } } } when using samsung health data sdk to read today's nutrition data is as follows reading nutrition data with samsung health data sdk suspend fun readtodaynutrition healthdatastore healthdatastore { val starttime = localdate now atstartofday val endtime = localdatetime now val readrequest = datatypes nutrition readdatarequestbuilder setlocaltimefilter localtimefilter of starttime, endtime build try { val readresult = healthdatastore readdata readrequest if readresult datalist isempty { log i mainactivity app_tag, "no nutrition today" return } readresult datalist foreach { healthdata -> val title = healthdata getvalue datatype nutritiontype title val mealtype = healthdata getvalue datatype nutritiontype meal_type val calories = healthdata getvalue datatype nutritiontype calories log i mainactivity app_tag, "today nutrition $title, $mealtype, $calories" } } catch e exception { e printstacktrace } } here is an example code to write nutrition data when using samsung health sdk for android writing nutrition data with samsung health sdk for android fun insertnutrition healthdatastore healthdatastore { val mydevice = healthdevicemanager healthdatastore val mealtitle = "toast and coffee" val calories = 66f val totalfat = 0 8f val saturatedfat = 0 1f val protein = 2 1f val carbohydrate = 11 9f val totalsugars = 1f val dietaryfiber = 0 6f val sodium = 135f val calcium = 40 3f val iron = 0 78f val potassium = 140f val referenceindexforironinmilligrams = 8 1f val referenceindexforcalciuminmilligrams = 1000f val starttime = instant now toepochmilli val timeoffset = timezone getdefault getoffset starttime tolong val data = healthdata apply { sourcedevice = mydevice localdevice uuid putlong healthconstants nutrition start_time, starttime ; putlong healthconstants nutrition time_offset, timeoffset ; putint healthconstants nutrition meal_type, meal_type_breakfast putstring healthconstants nutrition title, mealtitle putfloat healthconstants nutrition calorie, calories putfloat healthconstants nutrition total_fat, totalfat putfloat healthconstants nutrition saturated_fat, saturatedfat putfloat healthconstants nutrition protein, protein putfloat healthconstants nutrition carbohydrate, carbohydrate putfloat healthconstants nutrition sugar, totalsugars putfloat healthconstants nutrition dietary_fiber, dietaryfiber putfloat healthconstants nutrition sodium, sodium putfloat healthconstants nutrition potassium, potassium val calciumaspercentofreferenceintake = calcium / referenceindexforcalciuminmilligrams * 100 val ironinpercentofreferenceintake= iron / referenceindexforironinmilligrams * 100 putfloat healthconstants nutrition calcium, calciumaspercentofreferenceintake putfloat healthconstants nutrition iron, ironinpercentofreferenceintake } val insertrequest = healthdataresolver insertrequest builder setdatatype healthconstants nutrition health_data_type build val handler = handler looper getmainlooper val healthdataresolver = healthdataresolver healthdatastore, handler try { insertrequest addhealthdata data val insertresult = healthdataresolver insert insertrequest await log i tag, "insertnutrition status ${insertresult status}" } catch e exception { e printstacktrace } } when using samsung health data sdk to write nutrition data is as follows writing nutrition data with samsung health data sdk suspend fun insertnutrition healthdatastore healthdatastore { val starttime = localdatetime now val mealtitle = "toast and coffee" val calories = 66f val totalfat = 0 8f val saturatedfat = 0 1f val protein = 2 1f val carbohydrate = 11 9f val sugar = 1f val dietaryfiber = 0 6f val sodium = 135f val calcium = 40 3f val iron = 0 78f val potassium = 140f try { val healthdatapoint = healthdatapoint builder setlocalstarttime starttime addfielddata datatype nutritiontype meal_type, mealtype breakfast addfielddata datatype nutritiontype title, mealtitle addfielddata datatype nutritiontype calories, calories addfielddata datatype nutritiontype total_fat, totalfat addfielddata datatype nutritiontype saturated_fat, saturatedfat addfielddata datatype nutritiontype protein, protein addfielddata datatype nutritiontype carbohydrate, carbohydrate addfielddata datatype nutritiontype sugar, sugar addfielddata datatype nutritiontype dietary_fiber, dietaryfiber addfielddata datatype nutritiontype sodium, sodium addfielddata datatype nutritiontype calcium, calcium addfielddata datatype nutritiontype iron, iron addfielddata datatype nutritiontype potassium, potassium build val insertdatarequest = datatypes nutrition insertdatarequestbuilder adddata healthdatapoint build healthdatastore insertdata insertdatarequest } catch e exception { e printstacktrace } } water intake the data types of samsung health sdk for android and samsung health data sdk are as follows samsung health sdk for android samsung health data sdk healthconstants waterintake waterintaketype example code for reading today's water intake data when using samsung health sdk for android is as follows reading water intake data with samsung health sdk for android fun readtodaytotalwaterintake healthdatastore healthdatastore { val starttime = localdate now atstartofday toinstant zoneoffset utc toepochmilli val endtime = localdatetime now toinstant zoneoffset utc toepochmilli val handler = handler looper getmainlooper val healthdataresolver = healthdataresolver healthdatastore, handler val waterintakeid = "water_intake_sum" val aggregaterequest = healthdataresolver aggregaterequest builder addfunction healthdataresolver aggregaterequest aggregatefunction sum, healthconstants waterintake amount, waterintakeid setlocaltimerange healthconstants waterintake start_time, healthconstants waterintake time_offset, starttime, endtime setdatatype healthconstants waterintake health_data_type build try { healthdataresolver aggregate aggregaterequest setresultlistener { result -> try { result? foreach { healthdata -> val waterintakesum = healthdata getfloat waterintakeid } } finally { result close } } } catch e exception { e printstacktrace } } when using samsung health data sdk to read today's water intake data is as follows reading water intake data with samsung health data sdk suspend fun readtodaytotalwaterintake healthdatastore com samsung android sdk health data healthdatastore { val starttime = localdate now atstartofday val endtime = localdatetime now val localtimefilter = localtimefilter of starttime, endtime val readrequest = datatype waterintaketype total requestbuilder setlocaltimefilter localtimefilter build try { val result = healthdatastore aggregatedata readrequest result datalist lastornull ? let { datapoint -> val waterintake = datapoint value } } catch e exception { e printstacktrace } } example code for writing water intake data when using samsung health sdk for android is as follows writing water intake data with samsung health sdk for android fun insertwaterintake healthdatastore healthdatastore { val mydevice = healthdevicemanager healthdatastore val wateramountinmilliliters = 250f val unitamount = 250f val starttime = instant now toepochmilli val timeoffset = timezone getdefault getoffset starttime tolong val data = healthdata apply { sourcedevice = mydevice localdevice uuid putlong healthconstants waterintake start_time, starttime ; putlong healthconstants waterintake time_offset, timeoffset ; putfloat healthconstants waterintake amount, wateramountinmilliliters putfloat healthconstants waterintake unit_amount, unitamount } val insertrequest = healthdataresolver insertrequest builder setdatatype healthconstants waterintake health_data_type build val handler = handler looper getmainlooper val healthdataresolver = healthdataresolver healthdatastore, handler try { insertrequest addhealthdata data val insertresult = healthdataresolver insert insertrequest await log i tag, "insertwaterintake status ${insertresult status}" } catch e exception { e printstacktrace } } when using samsung health data sdk to write water intake data is as follows writing water intake data with samsung health data sdk suspend fun insertwaterintake healthdatastore healthdatastore { val starttime = localdatetime now val wateramountinmilliliters = 250f try { val healthdatapoint = healthdatapoint builder setlocalstarttime starttime addfielddata datatype waterintaketype amount, wateramountinmilliliters build val insertdatarequest = datatypes water_intake insertdatarequestbuilder adddata healthdatapoint build healthdatastore insertdata insertdatarequest } catch e exception { e printstacktrace } } sleep and sleep stage the data types of samsung health sdk for android and samsung health data sdk are as follows samsung health sdk for android samsung health data sdk healthconstants sleep healthconstants sleepstage sleeptype code for reading the last night's sleep data when using samsung health sdk for android is as follows reading the last night's sleep data with samsung health sdk for android fun readlastsleep healthdatastore healthdatastore { val handler = handler looper getmainlooper val healthdataresolver = healthdataresolver healthdatastore, handler val resultcount = 1 val resultoffset = 0 val request healthdataresolver readrequest = healthdataresolver readrequest builder setdatatype healthconstants sleep health_data_type setsort healthconstants sleep start_time, sortorder desc setresultcount resultoffset, resultcount build try { healthdataresolver read request setresultlistener { result -> try { result lastornull ? let { healthdata -> val sleepid = healthdata getstring healthconstants sleep uuid val sleepstarttime = instant ofepochmilli healthdata getlong healthconstants sleep start_time val sleependtime = instant ofepochmilli healthdata getlong healthconstants sleep end_time readsleepstagesforsleepid healthdatastore, sleepid } } finally { result close } } } catch e exception { e printstacktrace } } fun readsleepstagesforsleepid healthdatastore healthdatastore, sleepid string { val handler = handler looper getmainlooper val healthdataresolver = healthdataresolver healthdatastore, handler val request healthdataresolver readrequest = healthdataresolver readrequest builder setdatatype healthconstants sleepstage health_data_type setfilter filter eq healthconstants sleepstage sleep_id, sleepid build try { healthdataresolver read request setresultlistener { result -> try { result? foreach { sleepstagedata -> val sleepstagename = sleepstagenamebyid sleepstagedata getint healthconstants sleepstage stage val sleepstagestarttime = instant ofepochmilli sleepstagedata getlong healthconstants sleepstage start_time val sleepstageendtime = instant ofepochmilli sleepstagedata getlong healthconstants sleepstage end_time } } finally { result close } } } catch e exception { e printstacktrace } } fun sleepstagenamebyid id int string { return when id { healthconstants sleepstage stage_awake -> "awake" healthconstants sleepstage stage_deep -> "deep" healthconstants sleepstage stage_light -> "light" healthconstants sleepstage stage_rem -> "rem" else -> "" } } when using samsung health data sdk to read the last night's sleep data is as follows reading the last night's sleep data with samsung health data sdk suspend fun readsleeptotalduration healthdatastore healthdatastore { val daysbackoffset = 400l val starttime = localdate now minusdays daysbackoffset val endtime = localdate now val localdatefilter = localdatefilter of starttime, endtime val request = datatype sleeptype total_duration requestbuilder setlocaldatefilter localdatefilter build try { val result = healthdatastore aggregatedata request result datalist foreach { aggregateddata -> val starttime = aggregateddata starttime val endtime = aggregateddata endtime val totalduration = aggregateddata value } } catch e exception { e printstacktrace } } suspend fun readlastsleep healthdatastore healthdatastore { val resultcount = 1 val readrequest = datatypes sleep readdatarequestbuilder setordering ordering desc setlimit resultcount build try { val result = healthdatastore readdata readrequest result datalist lastornull ? let { sleepdata -> val sleepid = sleepdata uid val sleepstarttime = sleepdata starttime val sleependtime = sleepdata endtime val sleepsessions = sleepdata getvalue datatype sleeptype sessions sleepsessions? foreach { sleepsession -> val sessionduration = sleepsession duration val sessionstarttime = sleepsession starttime val sessionendtime = sleepsession endtime val sleepstages = sleepsession stages sleepstages? foreach { sleepstage -> val sleepstagename = sleepstage stage name val sleepstagestarttime = sleepstage starttime val sleepstageendtime = sleepstage endtime } } } } catch e exception { e printstacktrace } } code for writing sleep data when using samsung health sdk for android is as follows writing the last night's sleep data with samsung health sdk for android fun insertsleepdata healthdatastore healthdatastore { val handler = handler looper getmainlooper val healthdataresolver = healthdataresolver healthdatastore, handler val healthdevicemanager = healthdevicemanager healthdatastore val zoneoffset = zoneoffset systemdefault rules getoffset instant now val starttime = localdate now minusdays 1 attime 23, 10 toinstant zoneoffset val endtime = localdate now attime 6, 30 toinstant zoneoffset val timeoffset = timezone getdefault getoffset instant now toepochmilli val sleepdata = healthdata apply { sourcedevice = healthdevicemanager localdevice uuid putlong healthconstants sleep start_time, starttime toepochmilli putlong healthconstants sleep end_time, endtime toepochmilli putlong healthconstants sleep time_offset, timeoffset tolong } val insertrequest = insertrequest builder setdatatype healthconstants sleep health_data_type build insertrequest addhealthdata sleepdata try { val insertresult = healthdataresolver insert insertrequest await if insertresult status != baseresult status_successful { log i mainactivity app_tag, "error inserting sleep data error code ${insertresult status}" } } catch e exception { e printstacktrace } val resultcount = 1 val resultoffset = 0 val readrequest = healthdataresolver readrequest builder setdatatype healthconstants sleep health_data_type setsort healthconstants sleep update_time, sortorder desc setresultcount resultoffset, resultcount build try { val readresult = healthdataresolver read readrequest await val sleepid = readresult last getstring healthconstants sleep uuid writesleepstages healthdatastore, sleepid } catch e exception { e printstacktrace } } private fun writesleepstages healthdatastore healthdatastore, sleepid string { val handler = handler looper getmainlooper val healthdataresolver = healthdataresolver healthdatastore, handler val healthdevicemanager = healthdevicemanager healthdatastore val startdate = localdate now minusdays 1 val enddate = localdate now val zoneoffset = zoneoffset systemdefault rules getoffset instant now val timeoffset = timezone getdefault getoffset instant now toepochmilli val sleepstages = mutablelistof<healthdata> var sleepstage = healthdata apply { sourcedevice = healthdevicemanager localdevice uuid putlong healthconstants sleepstage time_offset, timeoffset tolong putstring healthconstants sleepstage sleep_id, sleepid putlong healthconstants sleepstage start_time, startdate attime 23, 10 toinstant zoneoffset toepochmilli putlong healthconstants sleepstage end_time, startdate attime 23, 35 toinstant zoneoffset toepochmilli putint healthconstants sleepstage stage, healthconstants sleepstage stage_light } sleepstages add sleepstage sleepstage = healthdata apply { sourcedevice = healthdevicemanager localdevice uuid putlong healthconstants sleepstage time_offset, timeoffset tolong putstring healthconstants sleepstage sleep_id, sleepid putlong healthconstants sleepstage start_time, startdate attime 23, 35 toinstant zoneoffset toepochmilli putlong healthconstants sleepstage end_time, enddate attime 1, 50 toinstant zoneoffset toepochmilli putint healthconstants sleepstage stage, healthconstants sleepstage stage_deep } sleepstages add sleepstage sleepstage = healthdata apply { sourcedevice = healthdevicemanager localdevice uuid putlong healthconstants sleepstage time_offset, timeoffset tolong putstring healthconstants sleepstage sleep_id, sleepid putlong healthconstants sleepstage start_time, enddate attime 1, 50 toinstant zoneoffset toepochmilli putlong healthconstants sleepstage end_time, enddate attime 2, 20 toinstant zoneoffset toepochmilli putint healthconstants sleepstage stage, healthconstants sleepstage stage_rem } sleepstages add sleepstage sleepstage = healthdata apply { sourcedevice = healthdevicemanager localdevice uuid putlong healthconstants sleepstage time_offset, timeoffset tolong putstring healthconstants sleepstage sleep_id, sleepid putlong healthconstants sleepstage start_time, enddate attime 2, 20 toinstant zoneoffset toepochmilli putlong healthconstants sleepstage end_time, enddate attime 2, 55 toinstant zoneoffset toepochmilli putint healthconstants sleepstage stage, healthconstants sleepstage stage_light } sleepstages add sleepstage sleepstage = healthdata apply { sourcedevice = healthdevicemanager localdevice uuid putlong healthconstants sleepstage time_offset, timeoffset tolong putstring healthconstants sleepstage sleep_id, sleepid putlong healthconstants sleepstage start_time, enddate attime 2, 55 toinstant zoneoffset toepochmilli putlong healthconstants sleepstage end_time, enddate attime 3, 10 toinstant zoneoffset toepochmilli putint healthconstants sleepstage stage, healthconstants sleepstage stage_awake } sleepstages add sleepstage sleepstage = healthdata apply { sourcedevice = healthdevicemanager localdevice uuid putlong healthconstants sleepstage time_offset, timeoffset tolong putstring healthconstants sleepstage sleep_id, sleepid putlong healthconstants sleepstage start_time, enddate attime 3, 10 toinstant zoneoffset toepochmilli putlong healthconstants sleepstage end_time, enddate attime 4, 30 toinstant zoneoffset toepochmilli putint healthconstants sleepstage stage, healthconstants sleepstage stage_deep } sleepstages add sleepstage sleepstage = healthdata apply { sourcedevice = healthdevicemanager localdevice uuid putlong healthconstants sleepstage time_offset, timeoffset tolong putstring healthconstants sleepstage sleep_id, sleepid putlong healthconstants sleepstage start_time, enddate attime 4, 30 toinstant zoneoffset toepochmilli putlong healthconstants sleepstage end_time, enddate attime 5, 10 toinstant zoneoffset toepochmilli putint healthconstants sleepstage stage, healthconstants sleepstage stage_rem } sleepstages add sleepstage sleepstage = healthdata apply { sourcedevice = healthdevicemanager localdevice uuid putlong healthconstants sleepstage time_offset, timeoffset tolong putstring healthconstants sleepstage sleep_id, sleepid putlong healthconstants sleepstage start_time, enddate attime 5, 10 toinstant zoneoffset toepochmilli putlong healthconstants sleepstage end_time, enddate attime 6, 20 toinstant zoneoffset toepochmilli putint healthconstants sleepstage stage, healthconstants sleepstage stage_light } sleepstages add sleepstage sleepstage = healthdata apply { sourcedevice = healthdevicemanager localdevice uuid putlong healthconstants sleepstage time_offset, timeoffset tolong putstring healthconstants sleepstage sleep_id, sleepid putlong healthconstants sleepstage start_time, enddate attime 6, 20 toinstant zoneoffset toepochmilli putlong healthconstants sleepstage end_time, enddate attime 6, 30 toinstant zoneoffset toepochmilli putint healthconstants sleepstage stage, healthconstants sleepstage stage_awake } sleepstages add sleepstage val insertrequest = insertrequest builder setdatatype healthconstants sleepstage health_data_type build insertrequest addhealthdata sleepstages try { val insertresult = healthdataresolver insert insertrequest await if insertresult status != baseresult status_successful { log i mainactivity app_tag, "error inserting stages data error code ${insertresult status}" } } catch e exception { e printstacktrace } } when using samsung health data sdk to write sleep data is as follows writing the last night's sleep data with samsung health data sdk suspend fun insertsleepdata healthdatastore healthdatastore { val startdate = localdate now minusdays 1 val enddate = localdate now val starttime = startdate attime 23, 10 val endtime = enddate attime 6, 30 val zoneoffset = zoneoffset systemdefault rules getoffset instant now val duration = duration between starttime, endtime val sleepstagelist = listof sleepsession sleepstage of startdate attime 23, 10 toinstant zoneoffset , startdate attime 23, 35 toinstant zoneoffset , datatype sleeptype stagetype light , sleepsession sleepstage of startdate attime 23, 35 toinstant zoneoffset , enddate attime 1, 50 toinstant zoneoffset , datatype sleeptype stagetype deep , sleepsession sleepstage of enddate attime 1, 50 toinstant zoneoffset , enddate attime 2, 20 toinstant zoneoffset , datatype sleeptype stagetype rem , sleepsession sleepstage of enddate attime 2, 20 toinstant zoneoffset , enddate attime 2, 55 toinstant zoneoffset , datatype sleeptype stagetype light , sleepsession sleepstage of enddate attime 2, 55 toinstant zoneoffset , enddate attime 3, 10 toinstant zoneoffset , datatype sleeptype stagetype awake , sleepsession sleepstage of enddate attime 3, 10 toinstant zoneoffset , enddate attime 4, 30 toinstant zoneoffset , datatype sleeptype stagetype deep , sleepsession sleepstage of enddate attime 4, 30 toinstant zoneoffset , enddate attime 5, 10 toinstant zoneoffset , datatype sleeptype stagetype rem , sleepsession sleepstage of enddate attime 5, 10 toinstant zoneoffset , enddate attime 6, 20 toinstant zoneoffset , datatype sleeptype stagetype light , sleepsession sleepstage of enddate attime 6, 20 toinstant zoneoffset , enddate attime 6, 30 toinstant zoneoffset , datatype sleeptype stagetype awake val sleepsession = sleepsession of starttime toinstant zoneoffset , endtime toinstant zoneoffset , duration, sleepstagelist try { val healthdatapoint = healthdatapoint builder setlocalstarttime starttime setlocalendtime endtime addfielddata datatype sleeptype duration, duration addfielddata datatype sleeptype sessions, listof sleepsession build val insertdatarequest = datatypes sleep insertdatarequestbuilder adddata healthdatapoint build healthdatastore insertdata insertdatarequest } catch e exception { e printstacktrace } } weight the corresponding weight data types in samsung health sdk for android and samsung health data sdk are as following samsung health sdk for android samsung health data sdk healthconstants weight bodycompositiontype to read the latest weight data when using samsung health sdk for android, the following example code can be used reading the last weight data with samsung health sdk for android fun readlatestweight healthdatastore healthdatastore { val resultcount = 1 val resultoffset = 0 val handler = handler looper getmainlooper val healthdataresolver = healthdataresolver healthdatastore, handler val request healthdataresolver readrequest = healthdataresolver readrequest builder setdatatype healthconstants weight health_data_type setsort healthconstants oxygensaturation start_time, sortorder desc setresultcount resultoffset, resultcount build try { healthdataresolver read request setresultlistener { result -> try { result lastornull ? let { healthdata -> val measurementstarttime = instant ofepochmilli healthdata getlong healthconstants weight start_time val weight = healthdata getfloat healthconstants weight weight val bodyfat = healthdata getfloat healthconstants weight body_fat } } finally { result close } } } catch e exception { e printstacktrace } } when using samsung health data sdk to read the latest weight data is as follows reading the last weight data with samsung health data sdk suspend fun readlatestweight healthdatastore healthdatastore { val resultcount = 1 val readrequest = datatypes body_composition readdatarequestbuilder setordering ordering desc setlimit resultcount build try { val result = healthdatastore readdata readrequest result datalist lastornull ? let { datapoint -> val weight = datapoint getvalue datatype bodycompositiontype weight val bodyfat = datapoint getvalue datatype bodycompositiontype body_fat val measurementstarttime = datapoint starttime } } catch e exception { e printstacktrace } } here is an example code to write weight data when using samsung health sdk for android writing weight data with samsung health sdk for android fun insertweightdata healthdatastore healthdatastore { val weight = 75f val zoneid = zoneoffset systemdefault val starttime = localdate now attime 9, 0 atzone zoneid toinstant toepochmilli val timeoffset = timezone getdefault getoffset starttime tolong val mhealthdataresolver = healthdataresolver healthdatastore, handler looper getmainlooper val healthdevicemanager = healthdevicemanager healthdatastore val data = healthdata apply { putlong healthconstants weight start_time, starttime putlong healthconstants weight time_offset, timeoffset putfloat healthconstants weight weight, weight // register local device as the source of data sourcedevice = healthdevicemanager localdevice uuid } try { val insertrequest = insertrequest builder setdatatype healthconstants weight health_data_type build insertrequest addhealthdata data val result = mhealthdataresolver insert insertrequest await log i mainactivity app_tag, "insert result status ${result status}" } catch e exception { e printstacktrace } } writing weight data with samsung health data sdk suspend fun insertweightdata healthdatastore healthdatastore { val weight = 75f val localdatetime = localdate now attime 9, 0 val zoneid = zoneoffset systemdefault val zoneoffset = zoneid rules getoffset localdatetime try { val healthdatapoint = healthdatapoint builder addfielddata datatype bodycompositiontype weight, weight setlocalstarttime localdatetime, zoneoffset build val insertrequest = datatypes body_composition insertdatarequestbuilder adddata healthdatapoint build healthdatastore insertdata insertrequest } catch e exception { e printstacktrace } } heart rate the corresponding heart rate data types in samsung health sdk for android and samsung health data sdk are as following samsung health sdk for android samsung health data sdk healthconstants heartrate heartratetype example code for reading today's heart rate data when using samsung health sdk for android is as follows reading today's heart rate data with samsung health sdk for android class readheartrate { fun readtodayheartrate healthdatastore healthdatastore { val starttime = localdate now atstartofday toinstant zoneoffset utc toepochmilli val endtime = localdatetime now toinstant zoneoffset utc toepochmilli val handler = handler looper getmainlooper val healthdataresolver = healthdataresolver healthdatastore, handler val request healthdataresolver readrequest = healthdataresolver readrequest builder setdatatype healthconstants heartrate health_data_type setlocaltimerange healthconstants heartrate start_time, healthconstants heartrate time_offset, starttime, endtime build try { healthdataresolver read request setresultlistener { result -> try { result? foreach { healthdata -> val heartrate = healthdata getfloat healthconstants heartrate heart_rate val measurementstarttime = instant ofepochmilli healthdata getlong healthconstants heartrate start_time val measurementendtime = instant ofepochmilli healthdata getlong healthconstants heartrate end_time val binningdata = healthdata getblob healthconstants heartrate binning_data val livedatalist = healthdatautil getstructureddatalist binningdata, heartratelivedata class java livedatalist foreach { livedatapoint -> val heartrate = livedatapoint heart_rate val starttime = instant ofepochmilli livedatapoint start_time } } } finally { result close } } } catch e exception { e printstacktrace } } } data class heartratelivedata val heart_rate float, val heart_rate_min float, val heart_rate_max float, val start_time long, val end_time long when using samsung health data sdk to read today's heart rate data is as follows reading today's heart rate data with samsung health data sdk suspend fun readtodayheartrate healthdatastore healthdatastore { val starttime = localdate now atstartofday val endtime = localdatetime now val localtimefilter = localtimefilter of starttime, endtime val readrequest = datatypes heart_rate readdatarequestbuilder setlocaltimefilter localtimefilter build try { val result = healthdatastore readdata readrequest result datalist foreach { datapoint -> val starttime = datapoint starttime val endtime = datapoint endtime val heartrate = datapoint getvalue datatype heartratetype heart_rate val heartrateseriesdata = datapoint getvalue datatype heartratetype series_data heartrateseriesdata? foreach { seriesdata -> val starttime = seriesdata starttime val heartrate = seriesdata heartrate } } } catch e exception { e printstacktrace } } to write heart rate data when using samsung health sdk for android, the following example code can be used writing heart rate data with samsung health sdk for android fun inserttodayheartrate healthdatastore healthdatastore { val tenminutesasseconds = 600l val heartrate = 76f val heartbeatcount = 1 val deviceid = healthdevicemanager healthdatastore localdevice uuid val starttime = instant now minusseconds tenminutesasseconds toepochmilli val endtime = instant now toepochmilli val timeoffset = timezone getdefault getoffset endtime tolong val healthdataresolver = healthdataresolver healthdatastore, null val healthdata = healthdata apply { sourcedevice = deviceid putlong heartrate start_time, starttime putlong heartrate end_time, endtime putlong heartrate time_offset, timeoffset putfloat heartrate heart_rate, heartrate putint heartrate heart_beat_count, heartbeatcount } val insertrequest = healthdataresolver insertrequest builder setdatatype heartrate health_data_type build insertrequest addhealthdata healthdata try { val result = healthdataresolver insert insertrequest await if result status == status_successful { log i mainactivity app_tag, "inserted heart rate count of data ${result count}" } else { log i mainactivity app_tag, "inserting failed" } } catch e exception { e printstacktrace } } when using samsung health data sdk to write heart rate data is as follows writing heart rate data with samsung health data sdk suspend fun inserttodayheartrate healthdatastore healthdatastore { val tenminutesasseconds = 600l val heartrate = 76f val starttime = localdatetime now minusseconds tenminutesasseconds val endtime = localdatetime now try { val healthdatapoint = healthdatapoint builder setlocalstarttime starttime setlocalendtime endtime addfielddata datatype heartratetype heart_rate, heartrate build val insertrequest = datatypes heart_rate insertdatarequestbuilder adddata healthdatapoint build healthdatastore insertdata insertrequest log i mainactivity app_tag, "inserted heart rate" } catch e exception { e printstacktrace } } blood glucose the corresponding blood glucose data types in samsung health sdk for android and samsung health data sdk are as following samsung health sdk for android samsung health data sdk healthconstants bloodglucose bloodglucosetype here is an example code to read today's blood glucose data when using samsung health sdk for android reading today's blood glucose data with samsung health sdk for android fun readtodaybloodglucose healthdatastore healthdatastore { val starttime = localdate now atstartofday toinstant zoneoffset utc toepochmilli val endtime = localdatetime now toinstant zoneoffset utc toepochmilli val handler = handler looper getmainlooper val healthdataresolver = healthdataresolver healthdatastore, handler val request healthdataresolver readrequest = healthdataresolver readrequest builder setdatatype healthconstants bloodglucose health_data_type setlocaltimerange healthconstants oxygensaturation start_time, healthconstants oxygensaturation time_offset, starttime, endtime build try { healthdataresolver read request setresultlistener { result -> try { result foreach { healthdata -> val measurementstarttime = instant ofepochmilli healthdata getlong healthconstants bloodglucose start_time val bloodglucose = healthdata getfloat healthconstants bloodglucose glucose //refer to the documentation for meal_type, measurement_type, sample_source_type mapping val mealtype = healthdata getint healthconstants bloodglucose meal_type val measurementtype = healthdata getint healthconstants bloodglucose measurement_type val samplesourcetype = healthdata getint healthconstants bloodglucose sample_source_type } } finally { result close } } } catch e exception { e printstacktrace } } when using samsung health data sdk to read today's blood glucose data is as follows reading today's blood glucose data with samsung health data sdk fun readtodaybloodglucose healthdatastore healthdatastore { val starttime = localdate now atstartofday toinstant zoneoffset utc toepochmilli val endtime = localdatetime now toinstant zoneoffset utc toepochmilli val handler = handler looper getmainlooper val healthdataresolver = healthdataresolver healthdatastore, handler val request healthdataresolver readrequest = healthdataresolver readrequest builder setdatatype healthconstants bloodglucose health_data_type setlocaltimerange healthconstants oxygensaturation start_time, healthconstants oxygensaturation time_offset, starttime, endtime build try { healthdataresolver read request setresultlistener { result -> try { result foreach { healthdata -> val measurementstarttime = instant ofepochmilli healthdata getlong healthconstants bloodglucose start_time val bloodglucose = healthdata getfloat healthconstants bloodglucose glucose //refer to the documentation for meal_type, measurement_type, sample_source_type mapping val mealtype = healthdata getint healthconstants bloodglucose meal_type val measurementtype = healthdata getint healthconstants bloodglucose measurement_type val samplesourcetype = healthdata getint healthconstants bloodglucose sample_source_type } } finally { result close } } } catch e exception { e printstacktrace } } code for writing sleep data when using samsung health sdk for android is as follows writing blood glucose data with samsung health sdk for android fun insertbloodglucosedata healthdatastore healthdatastore { val handler = handler looper getmainlooper val healthdataresolver = healthdataresolver healthdatastore, handler val healthdevicemanager = healthdevicemanager healthdatastore val tenminutesasseconds = 600l val starttime = instant now minusseconds tenminutesasseconds val timeoffset = timezone getdefault getoffset starttime toepochmilli val glucose = 4 8f val bloodglucosedata = healthdata apply { sourcedevice = healthdevicemanager localdevice uuid putlong healthconstants bloodpressure start_time, starttime toepochmilli putlong healthconstants bloodglucose time_offset, timeoffset tolong putfloat healthconstants bloodglucose glucose, glucose putint healthconstants bloodglucose measurement_type, healthconstants bloodglucose measurement_type_whole_blood putint healthconstants bloodglucose meal_type, healthconstants bloodglucose meal_type_fasting } val insertrequest = insertrequest builder setdatatype healthconstants bloodglucose health_data_type build insertrequest addhealthdata bloodglucosedata try { val insertresult = healthdataresolver insert insertrequest await if insertresult status != baseresult status_successful { log i mainactivity app_tag, "error inserting blood glucose data error code ${insertresult status}" } } catch e exception { e printstacktrace } } example code for writing blood glucose data when using samsung health data sdk is as follows writing blood glucose data with samsung health data sdk suspend fun insertbloodglucosedata healthdatastore healthdatastore { val starttime = localdatetime now minusminutes 10 val glucose = 4 8f try { val healthdatapoint = healthdatapoint builder setlocalstarttime starttime setlocalendtime starttime addfielddata datatype bloodglucosetype glucose_level, glucose addfielddata datatype bloodglucosetype measurement_type, datatype bloodglucosetype measurementtype whole_blood addfielddata datatype bloodglucosetype meal_status, datatype bloodglucosetype mealstatus fasting build val insertdatarequest = datatypes blood_glucose insertdatarequestbuilder adddata healthdatapoint build healthdatastore insertdata insertdatarequest } catch e exception { e printstacktrace } } blood oxygen the corresponding blood oxygen data types in samsung health sdk for android and samsung health data sdk are as following samsung health sdk for android samsung health data sdk healthconstants oxygensaturationtype bloodoxygentype example code for reading the latest blood oxygen data when using samsung health sdk for android is as follows reading the latest blood oxygen data with samsung health sdk for android fun readlatestbloodoxygen healthdatastore healthdatastore { val resultoffset = 0; val resultcount = 1 val handler = handler looper getmainlooper val healthdataresolver = healthdataresolver healthdatastore, handler val request healthdataresolver readrequest = healthdataresolver readrequest builder setdatatype healthconstants oxygensaturation health_data_type setsort healthconstants oxygensaturation start_time, sortorder desc setresultcount resultoffset, resultcount build try { healthdataresolver read request setresultlistener { result -> try { result lastornull ? let { healthdata -> val bloodoxygen = healthdata getfloat healthconstants oxygensaturation spo2 val measurementstarttime = instant ofepochmilli healthdata getlong healthconstants oxygensaturation start_time } } finally { result close } } } catch e exception { e printstacktrace } } when using samsung health data sdk to read the latest blood oxygen data is as follows reading the latest blood oxygen data with samsung health data sdk suspend fun readlatestbloodoxygen healthdatastore healthdatastore { val resultcount = 1 val readrequest = datatypes blood_oxygen readdatarequestbuilder setordering ordering desc setlimit resultcount build try { val result = healthdatastore readdata readrequest result datalist lastornull ? let { datapoint -> val bloodoxygen = datapoint getvalue datatype bloodoxygentype oxygen_saturation val measurementstarttime = datapoint starttime } } catch e exception { e printstacktrace } } here is an example code to write blood oxygen data when using samsung health sdk for android writing blood oxygen data with samsung health sdk for android fun insertbloodoxygendata healthdatastore healthdatastore { val bloodoxygen = 98f val tenminutesasseconds = 10l * 60l val zoneid = zoneoffset systemdefault val time = localdatetime now minusseconds tenminutesasseconds atzone zoneid toinstant toepochmilli val timeoffset = timezone getdefault getoffset time tolong val mhealthdataresolver = healthdataresolver healthdatastore, handler looper getmainlooper val healthdevicemanager = healthdevicemanager healthdatastore val data = healthdata apply { putlong healthconstants oxygensaturation start_time, time putlong healthconstants oxygensaturation end_time, time putlong healthconstants oxygensaturation time_offset, timeoffset putfloat healthconstants oxygensaturation spo2, bloodoxygen // register local device as the source of data sourcedevice = healthdevicemanager localdevice uuid } try { val insertrequest = insertrequest builder setdatatype healthconstants oxygensaturation health_data_type build insertrequest addhealthdata data val result = mhealthdataresolver insert insertrequest await log i mainactivity app_tag, "insert result status ${result status}" } catch e exception { e printstacktrace } } example code for writing blood oxygen data when using samsung health data sdk is as follows writing blood oxygen data with samsung health data sdk suspend fun insertbloodoxygendata healthdatastore healthdatastore { val bloodoxygen = 98f val tenminutesasseconds = 10l * 60l val time = localdatetime now minusseconds tenminutesasseconds val zoneid = zoneoffset systemdefault val zoneoffset = zoneid rules getoffset time try { val healthdatapoint = healthdatapoint builder addfielddata datatype bloodoxygentype oxygen_saturation, bloodoxygen setlocalstarttime time, zoneoffset setlocalendtime time, zoneoffset build val insertrequest = datatypes blood_oxygen insertdatarequestbuilder adddata healthdatapoint build healthdatastore insertdata insertrequest } catch e exception { e printstacktrace } } blood pressure the corresponding blood pressure data types in samsung health sdk for android and samsung health data sdk are as following samsung health sdk for android samsung health data sdk healthconstants bloodpressure bloodpressuretype code for reading the latest blood pressure data when using samsung health sdk for android is as follows reading the latest blood pressure data with samsung health sdk for android fun readlatestbloodpressure healthdatastore healthdatastore { val resultoffset = 0; val resultcount = 1 val handler = handler looper getmainlooper val healthdataresolver = healthdataresolver healthdatastore, handler val request healthdataresolver readrequest = healthdataresolver readrequest builder setdatatype healthconstants bloodpressure health_data_type setsort healthconstants bloodpressure start_time, sortorder desc setresultcount resultoffset, resultcount build try { healthdataresolver read request setresultlistener { result -> try { result? lastornull ? let { healthdata -> val starttime = instant ofepochmilli healthdata getlong healthconstants bloodpressure start_time val systolicpressure = healthdata getfloat healthconstants bloodpressure systolic val diastolicpressure = healthdata getfloat healthconstants bloodpressure diastolic val mean = healthdata getfloat healthconstants bloodpressure mean val pulse = healthdata getint healthconstants bloodpressure pulse val sourcepackagename = healthdata getstring healthconstants common package_name val sourcedeviceid = healthdata getstring healthconstants common device_uuid } } finally { result close } } } catch e exception { e printstacktrace } } when using samsung health data sdk to read the latest blood pressure data is as follows reading the latest blood pressure data with samsung health data sdk suspend fun readlatestbloodpressure healthdatastore healthdatastore { val resultcount = 1 val readrequest = datatypes blood_pressure readdatarequestbuilder setordering ordering desc setlimit resultcount build try { val result = healthdatastore readdata readrequest result datalist lastornull ? let { datapoint -> val starttime = datapoint starttime val systolicpressure = datapoint getvalue datatype bloodpressuretype systolic val diastolicpressure = datapoint getvalue datatype bloodpressuretype diastolic val mean = datapoint getvalue datatype bloodpressuretype mean val pulse = datapoint getvalue datatype bloodpressuretype pulse_rate val sourcepackagename = datapoint datasource? appid val sourcedeviceid = datapoint datasource? deviceid } } catch e exception { e printstacktrace } } code for writing blood pressure data when using samsung health sdk for android is as follows writing blood pressure data with samsung health sdk for android fun insertbloodpressuredata healthdatastore healthdatastore { val handler = handler looper getmainlooper val healthdataresolver = healthdataresolver healthdatastore, handler val healthdevicemanager = healthdevicemanager healthdatastore val tenminutesasseconds = 600l val starttime = instant now minusseconds tenminutesasseconds val timeoffset = timezone getdefault getoffset starttime toepochmilli val systolic = 119f val diastolic = 87f val mean = 0f val bloodpressuredata = healthdata apply { sourcedevice = healthdevicemanager localdevice uuid putlong healthconstants bloodpressure start_time, starttime toepochmilli putlong healthconstants bloodpressure time_offset, timeoffset tolong putfloat healthconstants bloodpressure systolic, systolic putfloat healthconstants bloodpressure diastolic, diastolic putfloat healthconstants bloodpressure mean, mean } val insertrequest = insertrequest builder setdatatype healthconstants bloodpressure health_data_type build insertrequest addhealthdata bloodpressuredata try { val insertresult = healthdataresolver insert insertrequest await if insertresult status != baseresult status_successful { log i mainactivity app_tag, "error inserting blood pressure data error code ${insertresult status}" } } catch e exception { e printstacktrace } } example code for writing blood pressure data when using samsung health data sdk is as follows writing blood pressure data with samsung health data sdk suspend fun insertbloodpressuredata healthdatastore healthdatastore { val starttime = localdatetime now minusminutes 10 val systolic = 119f val diastolic = 87f val mean = 0f try { val healthdatapoint = healthdatapoint builder setlocalstarttime starttime addfielddata datatype bloodpressuretype systolic, systolic addfielddata datatype bloodpressuretype diastolic, diastolic addfielddata datatype bloodpressuretype mean, mean build val insertdatarequest = datatypes blood_pressure insertdatarequestbuilder adddata healthdatapoint build healthdatastore insertdata insertdatarequest } catch e exception { e printstacktrace } } body temperature the corresponding body temperature data types in samsung health sdk for android and samsung health data sdk are as following samsung health sdk for android samsung health data sdk healthconstants bodytemperature bodytemperaturetype here is an example of code that reads today's body temperature data when using samsung health sdk for android reading today's body temperature data with samsung health sdk for android fun readtodaybodytemperature healthdatastore healthdatastore { val starttime = localdate now atstartofday toinstant zoneoffset utc toepochmilli val endtime = localdatetime now toinstant zoneoffset utc toepochmilli val handler = handler looper getmainlooper val healthdataresolver = healthdataresolver healthdatastore, handler val readrequest healthdataresolver readrequest = healthdataresolver readrequest builder setdatatype healthconstants bodytemperature health_data_type setlocaltimerange healthconstants bodytemperature start_time, healthconstants bodytemperature time_offset, starttime, endtime build try { healthdataresolver read readrequest setresultlistener { result -> try { result lastornull ? let { healthdata -> val measurementstarttime = date healthdata getlong healthconstants bodytemperature start_time val bodytemperature = healthdata getfloat healthconstants bodytemperature temperature } } finally { result close } } } catch e exception { e printstacktrace } } when using samsung health data sdk to read today's body temperature data is as follows reading today's body temperature samsung health data sdk suspend fun readtodaybodytemperature healthdatastore com samsung android sdk health data healthdatastore { val starttime = localdate now atstartofday val endtime = localdatetime now val localtimefilter = localtimefilter of starttime, endtime val readrequest = datatypes body_temperature readdatarequestbuilder setlocaltimefilter localtimefilter build try { val result = healthdatastore readdata readrequest result datalist lastornull ? let { datapoint -> val measurementstarttime = datapoint starttime val bodytemperature = datapoint getvalue datatype bodytemperaturetype body_temperature } } catch e exception { e printstacktrace } } example code for writing body temperature data when using samsung health sdk for android is as follows writing body temperature data with samsung health sdk for android fun insertbodytemperaturedata healthdatastore healthdatastore { val bodytemperature = 37f val tenminutesasseconds = 10l * 60l val zoneid = zoneoffset systemdefault val starttime = localdatetime now minusseconds tenminutesasseconds atzone zoneid toinstant toepochmilli val timeoffset = timezone getdefault getoffset starttime tolong val mhealthdataresolver = healthdataresolver healthdatastore, handler looper getmainlooper val healthdevicemanager = healthdevicemanager healthdatastore val data = healthdata apply { putlong healthconstants bodytemperature start_time, starttime putlong healthconstants bodytemperature time_offset, timeoffset putfloat healthconstants bodytemperature temperature, bodytemperature // register local device as the source of data sourcedevice = healthdevicemanager localdevice uuid } try { val insertrequest = insertrequest builder setdatatype healthconstants bodytemperature health_data_type build insertrequest addhealthdata data val result = mhealthdataresolver insert insertrequest await log i mainactivity app_tag, "insert result status ${result status}" } catch e exception { e printstacktrace } } when using samsung health data sdk to write body temperature data is as follows writing body temperature data with samsung health data sdk suspend fun insertbodytemperaturedata healthdatastore healthdatastore { val bodytemperature = 37f val tenminutesasseconds = 10l * 60l val time = localdatetime now minusseconds tenminutesasseconds val zoneid = zoneoffset systemdefault val zoneoffset = zoneid rules getoffset time try { val healthdatapoint = healthdatapoint builder addfielddata datatype bodytemperaturetype body_temperature, bodytemperature setlocalstarttime time, zoneoffset setlocalendtime time, zoneoffset build val insertrequest = datatypes body_temperature insertdatarequestbuilder adddata healthdatapoint build healthdatastore insertdata insertrequest } catch e exception { e printstacktrace } } user profile the corresponding user profile data types in samsung health sdk for android and samsung health data sdk are as following samsung health sdk for android samsung health data sdk healthuserprofile userprofiledatatype example code for getting user profile data when using samsung health sdk for android is as follows getting user profile data with samsung health sdk for android fun readuserprofile healthdatastore healthdatastore { val userprofile = healthuserprofile getprofile healthdatastore val gender = gendernamebyid userprofile gender val height = userprofile height val weight = userprofile weight } fun gendernamebyid id int string { return when id { healthuserprofile gender_male -> "male" healthuserprofile gender_female -> "female" else -> "unknown" } } example code for getting user profile data when using samsung health data sdk is as follows getting user profile data with samsung health data sdk suspend fun readuserprofile healthdatastore healthdatastore { val readrequest = datatypes user_profile readdatarequestbuilder build try { val result = healthdatastore readdata readrequest result datalist lastornull ? let { datapoint -> val gender = datapoint getvalue datatype userprofiledatatype gender val height = datapoint getvalue datatype userprofiledatatype height val weight = datapoint getvalue datatype userprofiledatatype weight } } catch e exception { e printstacktrace } } getting data's source device code for getting source device information that provided sleep data when using samsung health sdk for android is as follows getting data's source device information with samsung health sdk for android fun getsourcedeviceinfoofsleepdata healthdatastore healthdatastore { val resultcount = 1 val resultoffset = 0 val handler = handler looper getmainlooper val healthdataresolver = healthdataresolver healthdatastore, handler val request healthdataresolver readrequest = healthdataresolver readrequest builder setdatatype healthconstants sleep health_data_type setsort healthconstants sleep start_time, sortorder desc setresultcount resultoffset, resultcount build try { healthdataresolver read request setresultlistener { result -> try { result? foreach { healthdata -> val deviceid = healthdata getstring healthconstants sleep device_uuid val healthdevice = healthdevicemanager healthdatastore getdevicebyuuid deviceid val devicename = healthdevice customname val devicetype = devicegroupnamebyid healthdevice group } } finally { result close } } } catch e exception { e printstacktrace } } fun devicegroupnamebyid id int string { return when id { healthdevice group_mobile -> "mobile" healthdevice group_external -> "external" healthdevice group_companion -> "companion or watch" else -> "unknown" } } to get source device information that provided sleep data when using samsung health data sdk, the following example code can be used getting data's source device information with samsung health data sdk suspend fun getsourcedeviceinfoofsleepdata healthdatastore healthdatastore { val resultcount = 1 val readrequest = datatypes sleep readdatarequestbuilder setordering ordering desc setlimit resultcount build try { val result = healthdatastore readdata readrequest result datalist foreach { sleepdata -> val devicemanager = healthdatastore getdevicemanager sleepdata datasource? let { datasource -> val device = devicemanager getdevice datasource deviceid val deviceid = device? id val devicename = device? name val devicetype = device? devicetype } } } catch e exception { e printstacktrace } } partnership migration to samsung health data sdk once you have completed the migration implementation from samsung health sdk for android to samsung health data sdk and successfully finished testing using developer mode, you can request partnership migration to use samsung health data sdk during the partnership migration process, the partnership information previously approved for using samsung health sdk for android is leveraged, allowing you to complete the approval process for samsung health data sdk more efficiently here, you can find the instructions for partnership migration if you have already applied for partnership approval for samsung health data sdk using the application package name of your current app to write data to samsung health and use developer mode, you do not need to proceed with the partnership migration process having a trouble? we are operating a developer support channel on the samsung developer site if you encounter any issue or any question, please visit developer support and submit your query after logging in your samsung account
Develop Health
docdeveloper mode a partner app can connect with samsung health if its package name and signature sha256 are same with the registered info in samsung health the registered app signature is from the partner app's release key but in many cases, developers use a different app signing key to test or debug the app to make it easy, samsung health provides a developer mode the developer mode is not activated by default activating the developer mode requires an access key from samsung health 6 11 the access key is shared by samsung health team after a partnership approval how to activate the developer mode you can activate it with the following steps select the action overflow of samsung health on the top-left select the settings icon in the action list's top-right select about samsung health tap the version line region quickly 10 times or more the exact region to tap is illustrated with the blue box in the figure below if it succeeds, a developer mode button displays select the developer mode button and enter the developer mode page enter your app package name and access code that samsung health team shared and select the add button the access code is case-sensitive if it succeeds, your app package name will be listed up below it means the developer mode is activated for your app back to about samsung health with the back button on the top-left and select the info icon on the top-right now you can test your app with samsung health if your app package name is not added well please check the entered app package name and access code carefully they should be matched exactly a failure can be from entering a different app package name unmatched case for an access key how long will be maintained the added app's developer mode in the developer mode page is valid until uninstalling samsung health and it doesn't work for another app that has a different app package name if samsung health is reinstalled, enter your app package name and its access code if you remove your app from the developer mode page by selecting the "-" icon, the developer mode will be deactivated for your app
Develop Health
docprogramming guide samsung health sdk for android helps samsung health's partners to share health data safely and to create useful health applications samsung health has a health data store where its data can be shared with other partner apps after the user's consent it supports android devices with marshmallow 6 0 including non-samsung devices refer to the following table terms for samsung health sdk for android term description health data framework it provides useful features to handle the user's health data it is included in samsung health and its interface is provided with samsung health sdk for android an app that uses the sdk works with samsung health samsung health an application that helps monitor the user's activities and helps the users to have a healthier life through monitoring walking steps, exercise, heart rate, and etc it can be downloaded from the app market like google play or galaxy apps the term is italicized to be easily distinguished health data framework the health data framework of samsung health sdk for android has the following features health data store handling the connection to samsung health inserting, reading, updating, or deleting health data storing data based on unified units see api reference's descriptions for each data type health data type platform-defined and custom data type privacy granting permission based on the user's consent to read or write the specific data type architecture the sdk's health data framework is designed to provide safe access of its data and to have a seamless health service to the user the following figure shows the health data framework's architecture health data framework the health data framework is included in samsung health applications can access the user's data that are stored in samsung health through the sdk it keeps the user's health data safely health data from various source devices having pedometer, accelerator, or heart rate sensors are inserted to the health data framework with the unified data unit the data can be read by the sdk updating or deleting data is available if the app inserted the data the figure above shows the class and interface relationships in health data detailed descriptions for each class and interface are in the api reference healthdatastore it handles the connection to the data storage of the device it receives its connection result with healthdatastore connectionlistener most requests require the connection to the health data store healthdataresolver the health data framework provides classes and interfaces to insert, read, update, or delete the data healthdataresolver is a central class to handle the health data it sends a data request with related request interfaces the query result can be received immediately with healthdataholder baseresult, healthdataresolver readresult or healthdataresolver aggregateresult or it can be received asynchronously with healthresultholder resultlistener see health data store for more information application developers can use platform-defined data types that samsung health sdk for android provides see health data type for more information especially healthconstants common, the base interface of predefined data types, contains the following mandatory properties for health data unique id of health data created and updated time of health data application package name device that provides health data the health data can be accessed with the user's consent the following figure shows the relationship between classes and interfaces related to healthpermissionmanager it requests permissions to the user with healthpermissionmanager permissionkey to read or write for the specific health data type the permission result can be received synchronous or asynchronously see privacy for more information the sdk's health data library provides the following package com samsung android sdk healthdata main interfaces and classes in the library are described in the following table see the api reference for details interface / class description healthconnectionerrorresult this class handles errors for connection failure to the health data store healthconstants this class defines constants of health data and contains interfaces for various kinds such as the step count or exercise healthdata this class is an object for a health data type, e g the blood pressure or weight quantitative and qualitative values can be defined for the specific health data type based on its data structure definition it is used to manage health data with healthdataresolver healthdataobserver this class defines an observer to handle health data changes healthdataresolver this class accesses health data to insert, read, update, and delete with the filter and aggregate functions healthdatastore this class handles the connection to the data store in the device healthdataunit this class provides unified units for the health data store healthdatautil this class provides useful utility apis healthdevice this class contains detailed device information that provides health data healthdevicemanager this class manages devices related health data healthpermissionmanager this class requests permission to read or write health data for the specific health data type healthresultholder this interface represents the result of invoking method healthuserprofile this class provides the user information
Develop Health
docapp creation process creating an android app is available with the samsung health data sdk to develop and run an app using the sdk, the following process is required sdk download download the samsung health data sdk and check the sdk content samsung health data sdk v1 1 0 1 78 mb enabling developer mode you can check the sdk operation by turning on developer mode in samsung health notethe developer mode is intended only for testing or debugging your app it is not intended for app users do not share the developer mode guide with app users writing health data to samsung health to write health data to samsung health from an app, the access code is required you can request partnership and receive the access code after an approval developing your app create an android app project with importing the sdk library if you encounter any issue using the sdk, please submit your query on the developer support partnership request to distribute your app please submit partner request before your app distribution your app's information including the app package name and signature sha-256 will be registered in the samsung health's system after an approval otherwise, the app using the samsung health data sdk works only with the developer mode turned on our partnership is an exclusive service for the samsung health data sdk that allows users to discover engaging health and fitness apps partnership request troubleshooting and support if you encounter any issues, refer to faq or contact dev support
Develop Health
apioverview package class tree deprecated index com samsung android service health tracking enum healthtracker trackererror java lang object java lang enum<healthtracker trackererror> com samsung android service health tracking healthtracker trackererror all implemented interfaces serializable, comparable<healthtracker trackererror> enclosing class healthtracker public static enum healthtracker trackererror extends enum<healthtracker trackererror> errors thrown by healthtracker's event listener since 1 0 0 see also healthtracker trackereventlistener onerror healthtracker trackererror enum constant summary enum constants enum constant and description permission_error the user has not granted the required runtime permissions sdk_policy_error sdk policy represents a relationship between a partner application and the health platform method summary all methods static methods concrete methods modifier and type method and description static healthtracker trackererror valueof string name returns the enum constant of this type with the specified name static healthtracker trackererror[] values returns an array containing the constants of this enum type, in the order they are declared enum constant detail permission_error public static final healthtracker trackererror permission_error the user has not granted the required runtime permissions this error is common for all trackers an application needs to get required permissions before calling healthtracker seteventlistener public class mainactivity extends activity { @override protected void oncreate bundle savedinstancestate { // check and request permission if activitycompat checkselfpermission getapplicationcontext , "android permission body_sensors" == packagemanager permission_denied { requestpermissions this, new string[]{manifest permission body_sensors}, 0 ; } // } } since 1 0 0 see also healthtracker trackereventlistener onerror healthtracker trackererror checkselfpermission requestpermissions sdk_policy_error public static final healthtracker trackererror sdk_policy_error sdk policy represents a relationship between a partner application and the health platform a partner application that uses samsung health sensor sdk requires you to register application information in samsung's system, including an application package name, signature sha256 , and available tracker types sdk_policy_error occurs in the following cases if a running application's package name is not matched with a sdk policy the running application's package name is matched, but its signature sha256 is not to test the application, activate the health platform's developer mode find more information in the sdk guide the health tracker type is not registered a network is not connected or the connection quality is not good solving this error requires the samsung health team's support please submit an issue with a bug report at samsung developer site > developer support see more information in the sdk guide > developer support since 1 0 0 see also healthtracker trackereventlistener onerror healthtracker trackererror method detail values public static healthtracker trackererror[] values returns an array containing the constants of this enum type, in the order they are declared this method may be used to iterate over the constants as follows for healthtracker trackererror c healthtracker trackererror values system out println c ; returns an array containing the constants of this enum type, in the order they are declared valueof public static healthtracker trackererror valueof string name returns the enum constant of this type with the specified name the string must match exactly an identifier used to declare an enum constant in this type extraneous whitespace characters are not permitted parameters name - the name of the enum constant to be returned returns the enum constant with the specified name throws illegalargumentexception - if this enum type has no constant with the specified name nullpointerexception - if the argument is null
Develop Health
docsamsung health sensor sdk galaxy watch includes samsung’s unique bioactive sensor that drives the next era of digital health monitoring first introduced on the galaxy watch4 series, the bioactive sensor uses a single unique chip that combines three powerful health sensors — optical heart rate, electrical heart signal, and bioelectrical impedance analysis — to deliver extensive data that includes heart rate and blood oxygen level what is samsung health sensor sdk? samsung health sensor sdk is compatible with galaxy watch4 series and later models it provides both raw sensor signal data from the samsung bioactive sensor and processed data with our differentiated features sdk supports health tracking capabilities that allow apps to track user health data using the accelerometer, raw ecg electrocardiogram , ppg photoplethysmogram , and heart rate, including inter-beat intervals in addition, it provides access to health features such as body composition measurement, enabling a wide range of health and fitness use cases blood oxygen level and sweat loss data collected after a running workout can also be used to assess a user's health status improving health tracking capabilities with galaxy watch a watch application utilizing samsung health sensor sdk runs on a galaxy watch with wear os powered by samsung it will help users monitor their overall health data and promotes an enhanced healthy lifestyle the sdk can be applied in multiple health areas including fitness, remote patient monitoring, elderly care, digital therapy, managing fatigue risks, and corporate well-being programs benefits of samsung health sensor sdk reduced battery consumption samsung health sensor sdk's accelerometer data, ppg data, and heart rate data are all received as a continuous event the sdk's continuous tracker gathers sensor data in an application processor without waking up the cpu and sends an event at specific periods to a watch application this minimizes the watch's battery consumption and enables a watch application to track the user's status for the entire day receiving raw sensor data the accelerometer, ecg, and ppg data are provided as raw data by samsung health sensor sdk this is very helpful for developers when they conduct various analyses and more in-depth research with their own algorithm using galaxy watch specific features measuring the user's body composition, blood oxygen level, heart rate including the inter-beat interval, and sweat loss after a running workout is a feature specific to the galaxy watch using samsung health sensor sdk, your watch application can easily measure these data data types provided the following data types are supported by samsung health sensor sdk for more information, see health sensor data specifications data type details accelerometer raw x, y, and z axis data bia bioelectrical impedance analysis data mf-bia multi frequency bia ecg raw electrocardiogram data eda electrodermal activity heart rate heart rate data, including inter-beat interval ppg raw ppg green, infrared, and red data skin temperature skin temperature data spo2 blood oxygen level sweat loss lost water amount after a running workout restrictions samsung health sensor sdk only works on galaxy watch4 series and later models running wear os powered by samsung samsung health sensor sdk does not support an emulator sdk download you can download samsung health sensor sdk and begin development of integrating it into your app to use the sdk's apis in your app, please also check the app development process samsung health sensor sdk v1 4 1 70 8 kb experience samsung health sensor sdk try out samsung health sensor sdk with our code labs visit code lab to get started code labgalaxy watch, health measure blood oxygen level on galaxy watch code labgalaxy watch, health measure blood oxygen level and heart rate on galaxy watch code labgalaxy watch, health measure skin temperature on galaxy watch code labgalaxy watch, health transfer heart rate data from galaxy watch to a mobile device more content
Develop Health
apisamsung health data sdk/com samsung android sdk health data request/datatype/sleepapneatype sleepapneatype class sleepapneatype datatype, datatype readable<healthdatapoint, readdatarequest dualtimebuilder<healthdatapoint>> , datatype changereadable<healthdatapoint> the data type representing sleep apnea data specifications samsung health monitor monitors for severe obstructive sleep apnea with galaxy watch its sleep apnea risk detection feature detects signs that the user may have sleep apnea if the user grants permission in the samsung health monitor to synchronize its data with the samsung health app, samsung health monitor syncs sleep apnea data with samsung health for more information about the samsung health monitor’s sleep apnea feature, visit samsung health monitor predefined instanceusing the following instance allows for obtaining sleep apnea data with more concise code datatypes sleep_apnea required permissionthe user's consent is required to access this data type check the granted permissions and request permissions if the required permission is not granted yet with healthdatastore getgrantedpermissionshealthdatastore requestpermissionssee permission for a code example available operationshealthdatastore readdatahealthdatastore readdataasynchealthdatastore readchangeshealthdatastore readchangesasync data specificationsthis data type includes the following properties propertydescriptionuid[mandatory] the data's unique identifier assigned by samsung health starttime[mandatory]the timestamp representing the start of measurement, specified as instant in milliseconds zoneoffset[mandatory] the zoneoffset for starttime datasource[mandatory] the data's source information including the application package name and the device id detected_sign[mandatory] the detected sign of sleep apnea since1 1 0 members constructors sleepapneatype link copied to clipboard constructor types companion link copied to clipboard object companion detectedsign link copied to clipboard enum detectedsign enum<datatype sleepapneatype detectedsign> the detected sign enum of sleep apnea properties changeddatarequestbuilder link copied to clipboard open override val changeddatarequestbuilder changeddatarequest basicbuilder<healthdatapoint>retrieves a changeddatarequest instance to read changed sleep apnea data readdatarequestbuilder link copied to clipboard open override val readdatarequestbuilder readdatarequest dualtimebuilder<healthdatapoint>retrieves a readdatarequest instance to read sleep apnea data
Develop Health
apisamsung health data sdk/com samsung android sdk health data request/datatype/irregularheartrhythmnotificationtype irregularheartrhythmnotificationtype class irregularheartrhythmnotificationtype datatype, datatype readable<healthdatapoint, readdatarequest dualtimebuilder<healthdatapoint>> , datatype changereadable<healthdatapoint> the data type representing irregular heart rhythm notification data specifications samsung health monitor detects irregular heart rhythm with galaxy watch and provides notifications if the user grants permission in the samsung health monitor to synchronize its data with the samsung health app, samsung health monitor syncs irregular heart rhythm notification data with samsung health for more information about the samsung health monitor's irregular heart rhythm feature, visit samsung health monitor predefined instanceusing the following instance allows for obtaining irregular heart rhythm notification data with more concise code datatypes irregular_heart_rhythm_notification required permissionthe user's consent is required to access this data type check the granted permissions and request permissions if the required permission is not granted yet with healthdatastore getgrantedpermissionshealthdatastore requestpermissionssee permission for a code example available operationshealthdatastore readdatahealthdatastore readdataasynchealthdatastore readchangeshealthdatastore readchangesasync data specificationsthis data type includes the following properties propertydescriptionuid[mandatory] the data's unique identifier assigned by samsung health starttime[mandatory] the timestamp representing when the irregular heart rhythm was detected, specified as instant in milliseconds zoneoffset[mandatory] the zoneoffset for starttime datasource[mandatory] the data's source information including the application package name and the device id status[mandatory] the status of irregular heart rhythm detection it is represented as irregularheartrhythmstatus since1 1 0 members constructors irregularheartrhythmnotificationtype link copied to clipboard constructor types companion link copied to clipboard object companion irregularheartrhythmstatus link copied to clipboard enum irregularheartrhythmstatus enum<datatype irregularheartrhythmnotificationtype irregularheartrhythmstatus> the status enum of irregular heart rhythm detection properties changeddatarequestbuilder link copied to clipboard open override val changeddatarequestbuilder changeddatarequest basicbuilder<healthdatapoint>retrieves a changeddatarequest instance to read changed irregular heart rhythm notification data readdatarequestbuilder link copied to clipboard open override val readdatarequestbuilder readdatarequest dualtimebuilder<healthdatapoint>retrieves a readdatarequest instance to read irregular heart rhythm notification data
Develop Health
webpartnerships samsung collaborates with the world’s most innovative organizations to pave the way for better health and wellness by advancing solutions in connected care. explore sdks explore sdks contact us contact us inspiring the future through research and innovation from academic and research institutions to industry-leading digital health innovators, we work with a wide range of partners to fuel groundbreaking studies, accelerate new technology, and advance samsung’s end-to-end wellness platform, with the goal of creating an ecosystem that focuses on better health for all.with a history rooted in innovation, human-centered technology, and intuitive design, samsung is committed to building a more connected, healthier future, and we’re inspired by the partnerships that make this possible. digital health spotlight harnessing the power of ai: a sneak peek into how samsung is turning complexity to comprehension. "ai holds great promise for health, powering more comprehensive and personalized insights, as well as predicting potential health issues." - dr. hon pak. head of samsung electronics mx digital health team read full article digital health blog discover samsung’s latest insights on digital health and the future of connected care. read the blog fostering innovation through collaboration since launching over a decade ago, samsung health has evolved from a simple self-management tool to a complete set of care features, providing a comprehensive picture of your health. samsung health sdk suite the samsung health software development kit (sdk) suite is launched, helping developers enhance healthcare technology. heartbeat study samsung, tulane, and huma launch a study to improve the early detection and prevention of cardiovascular diseases. sleep apnea research stanford medicine and samsung join forces to enhance galaxy watch’s sleep apnea detection feature. open innovation initiative samsung announces the open innovation initiative, building a digital health ecosystem with universities and hospitals. virtual care expansion samsung works with centene to expand access to telehealth for individuals living in rural and underserved communities. sleep education the national sleep foundation teams up with samsung to provide sleep health education within the samsung health app. diabetes wellness program samsung health introduces the diabetes wellness program, helping adults with type 2 diabetes manage their condition. blood pressure research samsung and uc san francisco develop an app that uses galaxy smartphones to monitor blood pressure and stress levels. connected smartwatches mobilehelp and samsung add emergency call functionality to gear 3 smartwatches, making it easier to receive urgent care. next-gen digital health samsung announces a collaboration with partners healthcare to develop the next generation of digital health solutions. integrated health records samsung partners with b.well, empowering users to manage their health records from the samsung health app. fda clearance samsung health app receives fda clearance, allowing it to interface with medical devices in the united states. samsung health app samsung launches a free personal wellness app, initially known as s health but eventually rebranded as samsung health. samsung health sdk suite the samsung health software development kit (sdk) suite is launched, helping developers enhance healthcare technology. heartbeat study samsung, tulane, and huma launch a study to improve the early detection and prevention of cardiovascular diseases. sleep apnea research stanford medicine and samsung join forces to enhance galaxy watch’s sleep apnea detection feature. open innovation initiative samsung announces the open innovation initiative, building a digital health ecosystem with universities and hospitals. virtual care expansion samsung works with centene to expand access to telehealth for individuals living in rural and underserved communities. sleep education the national sleep foundation teams up with samsung to provide sleep health education within the samsung health app. diabetes wellness program samsung health introduces the diabetes wellness program, helping adults with type 2 diabetes manage their condition. blood pressure research samsung and uc san francisco develop an app that uses galaxy smartphones to monitor blood pressure and stress levels. connected smartwatches mobilehelp and samsung add emergency call functionality to gear 3 smartwatches, making it easier to receive urgent care. next-gen digital health samsung announces a collaboration with partners healthcare to develop the next generation of digital health solutions. integrated health records samsung partners with b.well, empowering users to manage their health records from the samsung health app. fda clearance samsung health app receives fda clearance, allowing it to interface with medical devices in the united states. samsung health app samsung launches a free personal wellness app, initially known as s health but eventually rebranded as samsung health. published research samsung and uga redefine energy in digital health samsung partners with the university of georgia to develop new ways to define and measure energy for enhancing digital health experiences. learn more estimating heart rate using smartphone videos samsung improves the estimation of heart rate and heart rate variability using videos taken with smartphones. learn more smartwatch-based detection and monitoring of atrial fibrillation a new algorithm uses smartwatches to detect atrial fibrillation (af), a common cardiac rhythm disorder. learn more in the news samsung collaborates with stanford to advance sleep apnea detection the joint research project will explore ways to enhance the sleep apnea feature on galaxy watch. understanding the mind-body connection through health research samsung works with partners to explore the critical role played by mental health in overall well-being. samsung electronics unveils samsung health research stack the platform empowers digital-health researchers to use data from mobile and wearable devices. bayer partners with samsung on menopause sleep study the observational study will explore the burden and impact of sleep disturbances during menopause. galaxy watch sleep apnea feature receives fda authorization the new feature will detect signs of obstructive sleep apnea, so people can seek medical care. irregular heart rhythm notification announced for galaxy watch users will have a new way to track abnormal heart rhythms and improve cardiovascular health. our featured partners
Develop Health
apioverviewpackageclasstreedeprecatedindex com samsung android sdk healthdata class healthdataobserver java lang object com samsung android sdk healthdata healthdataobserver public abstract class healthdataobserver extends object this class defines a health data observer for health data change adding an observer you can add an observer for the specific health data type and get notification in onchange string if the designated health data is changed in case that you add an observer for the data type that updates too frequently in short time like step count, it can send too many events to your application and it can bring degradation of your application's performance check that your application needs to update data with real-time from samsung health again before adding an observer a health data observer can be defined as below public class healthdataobserverexample { // the state of connection private healthdatastore mstore; public static final string app_tag = "myapp"; private final healthdataobserver mobserver = new healthdataobserver null { // checks notification for changed health data @override public void onchange string datatypename { log d app_tag, "health data is changed " ; readchangeddata datatypename ; } }; when you add an observer for the specific health data type, specify the data type name as below only data type is allowed to be observed public void start { // adds an observer for change of the weight healthdataobserver addobserver mstore, healthconstants weight health_data_type, mobserver ; } the change notification is received in onchange string and you can check updated health data as below private void readchangeddata string datatypename { healthdataresolver resolver = new healthdataresolver mstore, null ; healthdataresolver readrequest rdrequest = new healthdataresolver readrequest builder setdatatype datatypename build ; try { // make an asynchronous request to read health data resolver read rdrequest setresultlistener mrdlistener ; } catch exception e { log d app_tag, "healthdataresolver read fails " ; } } private final healthresultholder resultlistener<healthdataresolver readresult> mrdlistener = new healthresultholder resultlistener<healthdataresolver readresult> { @override public void onresult healthdataresolver readresult result { try { iterator<healthdata> iterator = result iterator ; if iterator hasnext { healthdata data = iterator next ; // check the result } } finally { result close ; } } }; } since 1 0 0 constructor summary constructors constructor and description healthdataobserver handler handler creates a healthdataobserver instance method summary all methods static methods instance methods abstract methods concrete methods modifier and type method and description static void addobserver healthdatastore store, string datatypename, healthdataobserver observer adds an observer that wants to follow data change for the given health data type abstract void onchange string datatypename called if health data registered as an observer is changed static void removeobserver healthdatastore store, healthdataobserver observer removes a registered observer constructor detail healthdataobserver public healthdataobserver handler handler creates a healthdataobserver instance parameters handler - the handler to run onchange string if it's null, onchange string event is run on binder thread which is invoked by samsung health since 1 0 0 method detail onchange public abstract void onchange string datatypename called if health data registered as an observer is changed parameters datatypename - the data type name that health data is changed since 1 0 0 addobserver public static void addobserver healthdatastore store, string datatypename, healthdataobserver observer adds an observer that wants to follow data change for the given health data type parameters store - the health data store for connection datatypename - the health data type name to follow change observer - an observer to receive notification if health data is changed throws illegalargumentexception - if the data type or observer is invalid illegalstateexception - if the instance of health data store is invalid or a remote-invocation error occurs in the connection since 1 0 0 removeobserver public static void removeobserver healthdatastore store, healthdataobserver observer removes a registered observer parameters store - health data store for connection observer - the added observer throws illegalargumentexception - if the observer is invalid illegalstateexception - if the instance of health data store is invalid or a remote-invocation error occurs in the connection since 1 0 0
We use cookies to improve your experience on our website and to show you relevant advertising. Manage you settings for our cookies below.
These cookies are essential as they enable you to move around the website. This category cannot be disabled.
These cookies collect information about how you use our website. for example which pages you visit most often. All information these cookies collect is used to improve how the website works.
These cookies allow our website to remember choices you make (such as your user name, language or the region your are in) and tailor the website to provide enhanced features and content for you.
You have successfully updated your cookie preferences.