Filter
-
Content Type
-
Category
Mobile/Wearable
Visual Display
Digital Appliance
Platform
Recommendations
Filter
tutorials health, galaxy watch, mobile
blogthe samsung privileged health sdk enables your application to collect vital signs and other health parameters tracked on galaxy watch running wear os powered by samsung. the tracked data can be displayed immediately or retained for later analysis. some kinds of tracked data, such as batching data, are impractical to display on a watch screen in real-time, so it is common to store the data in a database or server solution or show them on the larger screen of a mobile device. this blog demonstrates how to develop 2 connected sample applications. a watch application uses the samsung privileged health sdk to collect heart rate tracker data, then uses the wearable data layer api to transmit it to a companion application on the user’s android mobile device, which displays the data as a simple list on its screen. you can follow along with the demonstration by downloading the sample application project. to test the applications, you need a galaxy watch4 (or higher model) and a connected android mobile device. creating the application project the application project consists of a wearable module for the watch, and a mobile module for android mobile devices: in android studio, select open file > new > new project. select wear os > empty wear app and click next. new wear app define the project details. project details to create a companion mobile application for the watch application, check the pair with empty phone app box. notemake sure that the application id is identical for both modules in their “build.gradle” files. for more information about creating multi-module projects, see from wrist to hand: develop a companion app for your wearable application. implementing the watch application the watch application ui has 2 buttons. the start/stop button controls heart data tracking, and the send button transfers the collected data to the connected mobile device. the screen consists of a heart rate field and 4 ibi value fields, since there can be up to 4 ibi values in a single tracking result. watch application ui track and extract heart rate data when the user taps the start button on the wearable application ui, the starttracking() function from the mainviewmodel class is invoked. the application must check that the galaxy watch supports the heart rate tracking capability that we want to implement, as the supported capabilities depend on the device model and software version. retrieve the list of supported health trackers with the trackingcapability.supporthealthtrackertypes of the healthtrackingservice class: override fun hascapabilities(): boolean { log.i(tag, "hascapabilities()") healthtrackingservice = healthtrackingserviceconnection.gethealthtrackingservice() val trackers: list<healthtrackertype> = healthtrackingservice!!.trackingcapability.supporthealthtrackertypes return trackers.contains(trackingtype) } to track the heart rate values on the watch, read the flow of values received in the ondatareceived() listener: @experimentalcoroutinesapi override suspend fun track(): flow<trackermessage> = callbackflow { val updatelistener = object : healthtracker.trackereventlistener { override fun ondatareceived(datapoints: mutablelist<datapoint>) { for (datapoint in datapoints) { var trackeddata: trackeddata? = null val hrvalue = datapoint.getvalue(valuekey.heartrateset.heart_rate) val hrstatus = datapoint.getvalue(valuekey.heartrateset.heart_rate_status) if (ishrvalid(hrstatus)) { trackeddata = trackeddata() trackeddata.hr = hrvalue log.i(tag, "valid hr: $hrvalue") } else { coroutinescope.runcatching { trysendblocking(trackermessage.trackerwarningmessage(geterror(hrstatus.tostring()))) } } val validibilist = getvalidibilist(datapoint) if (validibilist.size > 0) { if (trackeddata == null) trackeddata = trackeddata() trackeddata.ibi.addall(validibilist) } if ((ishrvalid(hrstatus) || validibilist.size > 0) && trackeddata != null) { coroutinescope.runcatching { trysendblocking(trackermessage.datamessage(trackeddata)) } } if (trackeddata != null) { validhrdata.add(trackeddata) } } trimdatalist() } fun geterror(errorkeyfromtracker: string): string { val str = errors.getvalue(errorkeyfromtracker) return context.resources.getstring(str) } override fun onflushcompleted() { log.i(tag, "onflushcompleted()") coroutinescope.runcatching { trysendblocking(trackermessage.flushcompletedmessage) } } override fun onerror(trackererror: healthtracker.trackererror?) { log.i(tag, "onerror()") coroutinescope.runcatching { trysendblocking(trackermessage.trackererrormessage(geterror(trackererror.tostring()))) } } } heartratetracker = healthtrackingservice!!.gethealthtracker(trackingtype) setlistener(updatelistener) awaitclose { log.i(tag, "tracking flow awaitclose()") stoptracking() } } each tracking result is within a list in the datapoints argument of the ondatareceived() update listener. the sample application implements on-demand heart rate tracking, the update listener is invoked every second and each data point list contains 1 element. to extract a heart rate from data point: val hrvalue = datapoint.getvalue(valuekey.heartrateset.heart_rate) val hrstatus = datapoint.getvalue(valuekey.heartrateset.heart_rate_status) a status parameter is returned in addition to the heart rate data. if the heart rate reading was successful, its value is 1. each inter-beat interval data point consists of a list of values and the corresponding status for each value. since samsung privileged health sdk version 1.2.0, there can be up to 4 ibi values in a single data point, depending on the heart rate. if the ibi reading is valid, the value of the status parameter is 0. to extract only ibi data that is valid and whose value is not 0: private fun isibivalid(ibistatus: int, ibivalue: int): boolean { return ibistatus == 0 && ibivalue != 0 } fun getvalidibilist(datapoint: datapoint): arraylist<int> { val ibivalues = datapoint.getvalue(valuekey.heartrateset.ibi_list) val ibistatuses = datapoint.getvalue(valuekey.heartrateset.ibi_status_list) val validibilist = arraylist<int>() for ((i, ibistatus) in ibistatuses.withindex()) { if (isibivalid(ibistatus, ibivalues[i])) { validibilist.add(ibivalues[i]) } } send data to the mobile application the application uses the messageclient class of the wearable data layer api to send messages to the connected mobile device. messages are useful for remote procedure calls (rpc), one-way requests, or in request-or-response communication models. when a message is sent, if the sending and receiving devices are connected, the system queues the message for delivery and returns a successful result code. the successful result code does not necessarily mean that the message was delivered successfully, as the devices can be disconnected before the message is received. to advertise and discover devices on the same network with features that the watch can interact with, use the capabilityclient class of the wearable data layer api. each device on the network is represented as a node that supports various capabilities (features) that an application defines at build time or configures dynamically at runtime. your watch application can search for nodes with a specific capability and interact with it, such as sending messages. this can also work in the opposite direction, with the wearable application advertising the capabilities it supports. when the user taps the send button on the wearable application ui, the sendmessage() function from the mainviewmodel class is invoked, which triggers code in the sendmessageusecase class: override suspend fun sendmessage(message: string, node: node, messagepath: string): boolean { val nodeid = node.id var result = false nodeid.also { id -> messageclient .sendmessage( id, messagepath, message.tobytearray(charset = charset.defaultcharset()) ).apply { addonsuccesslistener { log.i(tag, "sendmessage onsuccesslistener") result = true } addonfailurelistener { log.i(tag, "sendmessage onfailurelistener") result = false } }.await() log.i(tag, "result: $result") return result } } to find a destination node for the message, retrieve all the available capabilities on the network: override suspend fun getcapabilitiesforreachablenodes(): map<node, set<string>> { log.i(tag, "getcapabilities()") val allcapabilities = capabilityclient.getallcapabilities(capabilityclient.filter_reachable).await() return allcapabilities.flatmap { (capability, capabilityinfo) -> capabilityinfo.nodes.map { it to capability } } .groupby( keyselector = { it.first }, valuetransform = { it.second } ) .mapvalues { it.value.toset() } } since the mobile module of the sample application advertises having the “wear” capability, to find an appropriate destination node, retrieve the list of connected nodes that support it: override suspend fun getnodesforcapability( capability: string, allcapabilities: map<node, set<string>> ): set<node> { return allcapabilities.filtervalues { capability in it }.keys } select the first node from the list, encode the message as a json string, and send the message to the node: suspend operator fun invoke(): boolean { val nodes = getcapablenodes() return if (nodes.isnotempty()) { val node = nodes.first() val message = encodemessage(trackingrepository.getvalidhrdata()) messagerepository.sendmessage(message, node, message_path) true } else { log.i(tag, "no compatible nodes found") false } } implementing the mobile application the mobile application ui consists of a list of the heart rate and inter-beat interval values received from the watch. the list is scrollable. mobile application ui receive and display data from the watch application to enable the mobile application to listen for data from the watch and launch when it receives data, define the datalistenerservice service in the mobile application’s androidmanifest.xml file, within the <application> element: <service android:name="com.samsung.health.mobile.data.datalistenerservice" android:exported="true"> <intent-filter> <action android:name="com.google.android.gms.wearable.data_changed" /> <action android:name="com.google.android.gms.wearable.message_received" /> <action android:name="com.google.android.gms.wearable.request_received" /> <action android:name="com.google.android.gms.wearable.capability_changed" /> <action android:name="com.google.android.gms.wearable.channel_event" /> <data android:host="*" android:pathprefix="/msg" android:scheme="wear" /> </intent-filter> </service> implement the datalistenerservice class in the application code to listen for and receive message data. the received json string data is passed as a parameter: private const val tag = "datalistenerservice" private const val message_path = "/msg" class datalistenerservice : wearablelistenerservice() { override fun onmessagereceived(messageevent: messageevent) { super.onmessagereceived(messageevent) val value = messageevent.data.decodetostring() log.i(tag, "onmessagereceived(): $value") when (messageevent.path) { message_path -> { log.i(tag, "service: message (/msg) received: $value") if (value != "") { startactivity( intent(this, mainactivity::class.java) .addflags(intent.flag_activity_new_task).putextra("message", value) ) } else { log.i(tag, "value is an empty string") } } } to decode the message data: fun decodemessage(message: string): list<trackeddata> { return json.decodefromstring(message) } to display the received data on the application screen: @composable fun mainscreen( results: list<trackeddata> ) { column( modifier = modifier .fillmaxsize() .background(color.black), verticalarrangement = arrangement.top, horizontalalignment = alignment.centerhorizontally ) { spacer( modifier .height(70.dp) .fillmaxwidth() .background(color.black) ) listview(results) } } running the applications to run the wearable and mobile applications: connect your galaxy watch and android mobile device (both devices must be paired with each other) to android studio on your computer. select wear from the modules list and the galaxy watch device from the devices list, then click run. the wearable application launches on the watch. connected devices select mobile from the modules list and the android mobile device from the devices list, then click run. the mobile application launches on the mobile device. wear the watch on your wrist and tap start. the watch begins tracking your heart rate. after some tracked values appear on the watch screen, to send the values to the mobile application, tap send. if the mobile application is not running, it is launched. the tracked heart data appears on the mobile application screen. to stop tracking, tap stop on the watch. conclusions the samsung privileged health sdk enables you to track health data, such as heart rate, from a user’s galaxy watch4 or higher smartwatch model. to display the tracked data on a larger screen, you can use the messageclient of the wearable data layer api to send the data to a companion application on the connected mobile device. to develop more advanced application features, you can also use the dataclient class to send data to devices not currently in range of the watch, delivering it only when the device is connected. resources heart rate data transfer code lab
Samsung Developers
Develop Health
docsamsung health sensor sdk the galaxy watch is equipped with 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 readings that include heart rate and blood oxygen level what is samsung health sensor sdk? the samsung health sensor sdk is specialized for galaxy watch4 devices or later it provides both raw sensor signal data from the samsung bioactive sensor and processed data with our differentiated features the sdk supports an improved health tracking capability to allow your applications to track the user's health data accurately with the accelerometer, raw ecg electrocardiogram , ppg photoplethysmogram , and heart rate including inter-beat interval in addition, it provides more advanced health features such as the body composition measurement, to enable compelling use cases for health and fitness applications the blood oxygen level and sweat loss after a running workout are also useful data to check a user's health status enhancing health tracking capabilities on galaxy watch a watch application utilizing the 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 diverse areas including fitness, remote patient monitoring, elderly care, digital therapy, managing fatigue risks, and corporate well-being programs samsung health sensor sdk advantages low watch battery consumption the 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 the samsung health sensor sdk this is very useful to conduct various analyses and more in-depth research with your 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 the samsung health sensor sdk, your watch application can easily measure these data data types provided the following data types are supported by the samsung health sensor sdk for more information, see health sensor data specifications data type details accelerometer raw x, y, and z axis data provided as a continuous event bia body composition data provided as an on-demand event ecg raw electrocardiogram data provided as an on-demand event heart rate heart rate data, including inter-beat interval provided as a continuous event ppg raw ppg green, infrared, and red data provided as a continuous and on-demand event skin temperature skin temperature data provided as a continuous and on-demand events spo2 blood oxygen level provided as an on-demand event sweat loss lost water amount after a running workout restrictions the samsung health sensor sdk only works on galaxy watch4 devices or later models running wear os powered by samsung samsung health sensor sdk does not support an emulator sdk download you can download the samsung health sensor sdk and check its content to use the sdk's apis in your app, please also check the app development process samsung health sensor sdk v1 3 0 2 47 mb experience samsung health sensor sdk try out the 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
websamsung health sensor sdk samsung health sensor sdk covers device-specific sensor data and enables partners to develop powerful health-sensing capabilities in their applications. the power of samsung health sensor sdk the sdk supports an improved health tracking capability that allows your applications to track the user’s health data with the accelerometer, raw ecg (electrocardiogram), ppg (photoplethysmogram), heart rate, including inter-beat interval, body composition, and skin temperature. view documentation request to become a partner are you building a wear os app and would like to integrate galaxy watch advanced sensors? request partnership get deeper health insights to open new possibilities the possible applications of the health data by samsung health sensor sdk are numerous, ranging from remote patient monitoring to digital therapeutics. in particular, the raw sensor signals and processed data can lead to the discovery of new digital biomarkers for detecting signs of certain health conditions. in a specific example, a partner app on galaxy watch can notify a user if it detects gait pattern anomalies while the user is walking, leading to an early prognosis of a health condition. featured partners frequently asked questions go to faq find the most frequently asked questions about samsung health sensor sdk. technical support submit ticket contact technical support for questions you have regarding the samsung health sdk suite. samsung account sign-in is required.
Develop Health
webtest page - samsung health sensor sdk samsung health sensor sdk covers device-specific sensor data and enables partners to develop powerful health-sensing capabilities in their applications. the power of samsung health sensor sdk the sdk supports an improved health tracking capability that allows your applications to track the user’s health data with the accelerometer, raw ecg (electrocardiogram), ppg (photoplethysmogram), heart rate, including inter-beat interval, body composition, and skin temperature. view documentation request to become a partner are you building a wear os app and would like to integrate galaxy watch advanced sensors? request download get deeper health insights to open new possibilities the possible applications of the health data by samsung health sensor sdk are numerous, ranging from remote patient monitoring to digital therapeutics. in particular, the raw sensor signals and processed data can lead to the discovery of new digital biomarkers for detecting signs of certain health conditions. in a specific example, a partner app on galaxy watch can notify a user if it detects gait pattern anomalies while the user is walking, leading to an early prognosis of a health condition. featured partners frequently asked questions go to faq find the most frequently asked questions about samsung health sensor sdk. technical support submit ticket contact technical support for questions you have regarding the samsung health sdk suite. samsung account sign-in is required.
Learn Code Lab
codelabtransfer heart rate data from galaxy watch to a mobile device objective create a health app for galaxy watch, operating on wear os powered by samsung, to measure heart rate and inter-beat interval ibi , send data to a paired android phone, and create an android application for receiving data sent from a paired galaxy watch overview with this code lab, you can measure various health data using samsung health sensor sdk and send it to a paired android mobile device for further processing samsung health sensor sdk tracks various health data, but it cannot save or send collected results meanwhile, wearable data layer allows you to synchronize data from your galaxy watch to an android mobile device using a paired mobile device allows the data to be more organized by taking advantage of a bigger screen and better performance see samsung health sensor sdk descriptions for detailed information set up your environment you will need the following galaxy watch4 or newer android mobile device android studio latest version recommended java se development kit jdk 17 or later sample code here is a sample code for you to start coding in this code lab download it and start your learning experience! heart rate data transfer sample code 213 7 kb connect your galaxy watch to wi-fi go to settings > connection > wi-fi and make sure that the wi-fi is enabled from the list of available wi-fi networks, choose and connect to the same one as your pc turn on developer mode and adjust its settings on your watch, go to settings > about watch > software and tap on software version 5 times upon successful activation of developer mode, a toast message will display as on the image below afterwards, developer options will be visible under settings tap developer options and enable the following options adb debugging in developer options find wireless debugging turn on wireless debugging check always allow on this network and tap allow go back to developer options and click turn off automatic wi-fi notethere may be differences in settings depending on your one ui version connect your galaxy watch to android studio go to settings > developer options > wireless debugging and choose pair new device take note of the wi-fi pairing code, ip address & port in android studio, go to terminal and type adb pair <ip address> <port> <wi-fi pairing code> when prompted, tap always allow from this computer to allow debugging after successfully pairing, type adb connect <ip address of your watch> <port> upon successful connection, you will see the following message in the terminal connected to <ip address of your watch> now, you can run the app directly on your watch turn on developer mode for health platform to use the app, you need to enable developer mode in the health platform on your watch go to settings > apps > health platform quickly tap health platform title for 10 times this enables developer mode and displays [dev mode] below the title to stop using developer mode, quickly tap health platform title for 10 times to disable it set up your android device click on the following links to setup your android device enable developer options run apps on a hardware device connect the galaxy watch with you samsung mobile phone start your project in android studio, click open to open an existing project locate the downloaded android project hrdatatransfer-code-lab from the directory and click ok you should see both devices and applications available in android studio as in the screenshots below initiate heart rate tracking noteyou may refer to this blog post for more detailed analysis of the heart rate tracking using samsung health sensor sdk first, you need to connect to the healthtrackingservice to do that create connectionlistener, create healthtrackingservice object by invoking healthtrackingservice connectionlistener, context invoke healthtrackingservice connectservice when connected to the health tracking service, check the tracking capability the available trackers may vary depending on samsung health sensor sdk, health platform versions or watch hardware version use the gettrackingcapability function of the healthtrackingservice object obtain heart rate tracker object using the function healthtrackingservice gethealthtracker healthtrackertype heart_rate_continuous define event listener healthtracker trackereventlistener, where the heart rate values will be collected start tracking the tracker starts collecting heart rate data when healthtracker seteventlistener updatelistener is invoked, using the event listener collect heart data from the watch the updatelistener collects datapoint instances from the watch, which contains a collection of valuekey objects those objects contain heart rate, ibi values, and ibi statuses there's always one value for heart rate while the number of ibi values vary from 0-4 both ibi value and ibi status lists have the same size go to wear > java > data > com samsung health hrdatatransfer > data under ibidataparsing kt, provide the implementation for the function below /******************************************************************************* * [practice 1] get list of valid inter-beat interval values from a datapoint * - return arraylist<int> of valid ibi values validibilist * - if no ibi value is valid, return an empty arraylist * * var ibivalues is a list representing ibivalues up to 4 * var ibistatuses is a list of their statuses has the same size as ibivalues ------------------------------------------------------------------------------- * - hints * use local function isibivalid status, value to check validity of ibi * ****************************************************************************/ fun getvalidibilist datapoint datapoint arraylist<int> { val ibivalues = datapoint getvalue valuekey heartrateset ibi_list val ibistatuses = datapoint getvalue valuekey heartrateset ibi_status_list val validibilist = arraylist<int> //todo 1 return validibilist } check data sending capabilities for the watch once the heart rate tracker can collect data, set up the wearable data layer so it can send data to a paired android mobile device wearable data layer api provides data synchronization between wear os and android devices noteto know more about wearable data layer api, go here to determine if a remote mobile device is available, the wearable data layer api uses concept of capabilities not to be confused with samsung health sensor sdk’s tracking capabilities, providing information about available tracker types using the wearable data layer's capabilityclient, you can get information about nodes remote devices being able to consume messages from the watch go to wear > java > com samsung health hrdatatransfer > data in capabilityrepositoryimpl kt, and fill in the function below the purpose of this part is to filter all capabilities represented by allcapabilities argument by capability argument and return the set of nodes set<node> having this capability later on, we need those nodes to send the message to them /************************************************************************************** * [practice 2] check capabilities for reachable remote nodes devices * - return a set of node objects out of all capabilities represented by 2nd function * argument, having the capability represented by 1st function argument * - return empty set if no node has the capability -------------------------------------------------------------------------------------- * - hints * you might want to use filtervalues function on the given allcapabilities map * ***********************************************************************************/ override suspend fun getnodesforcapability capability string, allcapabilities map<node, set<string>> set<node> { //todo 2 } encode message for the watch before sending the results of the heart rate and ibi to the paired mobile device, you need to encode the message into a string for sending data to the paired mobile device we are using wearable data layer api’s messageclient object and its function sendmessage string nodeid, string path, byte[] message go to wear > java > com samsung health hrdatatransfer > domain in sendmessageusecase kt, fill in the function below and use json format to encode the list of results arraylist<trackeddata> into a string /*********************************************************************** * [practice 3] - encode heart rate & inter-beat interval into string * - encode function argument trackeddata into json format * - return the encoded string ----------------------------------------------------------------------- * - hint * use json encodetostring function **********************************************************************/ fun encodemessage trackeddata arraylist<trackeddata> string { //todo 3 } notetrackeddata is an object, containing data received from heart rate tracker’s single datapoint object @serializable data class trackeddata var hr int, var ibi arraylist<int> = arraylist run unit tests for your convenience, you will find an additional unit tests package this will let you verify your code changes even without using a physical watch or mobile device see the instruction below on how to run unit tests right click on com samsung health hrdatatransfer test , and execute run 'tests in 'com samsung health hrdatatransfer" command if you have completed all the tasks correctly, you will see all the unit tests pass successfully run the app after building the apks, you can run the applications on your watch to measure heart rate and ibi values, and on your mobile device to collect the data from your watch once the app starts, allow the app to receive data from the body sensors afterwards, it shows the application's main screen to get the heart rate and ibi values, tap the start button tap the send button to send the data to your mobile device notethe watch keeps last ~40 values of heart rate and ibi you’re done! congratulations! you have successfully achieved the goal of this code lab now, you can create a health app on a watch to measure heart rate and ibi, and develop a mobile app that receives that health data! if you face any trouble, you may download this file heart rate data transfer complete code 213 9 kb to learn more about samsung health, visit developer samsung com/health
Develop Health
dochealth sensor data specifications notedata measured by the samsung health sensor sdk is for fitness and wellness information only, not for the diagnosis or treatment of any medical condition continuous tracker types a wear os application can retrieve the following health sensor data continuously with a periodic event until the event is unset tracker type raw / processed description accelerometer_continuous raw provides x, y, and z axis values measured with a 25 hz frequency measured data is retrieved with accelerometerset data points in trackereventlistener ondatareceived heart_rate_continuous processed heart rate data including inter-beat interval ibi measured with a 1 hz frequency [watch display - on] measured data is retrieved with 1 heartrateset data point in trackereventlistener ondatareceived [watch display - off] measured data is retrieved with heartrateset data points in trackereventlistener ondatareceived * ibi values for the complete tracking times are stored in the first data point the other data points contain null ppg_continuous raw includes photoplethysmogram ppg green, infrared ir , and red data measured with a 25 hz frequency measured data is retrieved with ppgset data points in trackereventlistener ondatareceived skin_temperature_ continuous processed skin temperature and ambient temperature around the galaxy watch this is not the same as body temperature [watch display - on] measured data is retrieved with 1 skintemperatureset data point in trackereventlistener ondatareceived [watch display - off] measured data is retrieved with skintemperatureset data points in trackereventlistener ondatareceived * tracking skin temperature is available with galaxy watch5 series and later models * for galaxy watch5, the skin temperature is measured after updating watch software to android 13 api level 33 or higher on-demand tracker types see using on-demand tracker type for more information on using an on-demand tracker type tracker type raw / processed description bia_on_demand processed body composition data measured data is retrieved with 1 biaset data point in trackereventlistener ondatareceived ecg_on_demand raw ecg data measured with a 500 hz frequency measured data is retrieved ecgset data points in trackereventlistener ondatareceived ppg_on_demand raw includes ppg green, ir, and red data measured with a 100 hz frequency measured data is retrieved 1 ppgset data point in trackereventlistener ondatareceived skin_temperature_on_demand processed skin temperature and ambient temperature around the galaxy watch this is not the same as body temperature measured data is retrieved 1 skintemperatureset data point in trackereventlistener ondatareceived * tracking skin temperature is available with galaxy watch 5 series and later model * for watch5, the skin temperature is measured after the watch software update for android 13 api level 33 or higher spo2_on_demand processed blood oxygen data measured data is retrieved 1 spo2set data point in trackereventlistener ondatareceived tracking spo2 is available with watch health platform v1 3 0 or above other measuring the user’s sweat loss amount after a running is available with the following tracker type tracker type raw / processed description sweat_loss processed sweat loss amount for a running exercise 1 sweatlossset data point is retrieved using on-demand tracker type when using an on-demand tracker type, please note the following information use the tracker in a foreground application, not in the background do not use more than one on-demand tracker at the same time an on-demand tracker type is not intended for continuous measurement track on-demand type sensors in 30 seconds during on-demand tracker type data measurement, tracking a continuous tracker type can give invalid values
Develop Health
docheart rate tracking with the off-body sensor battery consumption is a critical factor when developing applications that use device sensors to prolong battery life, the samsung health sensor sdk allows you to implement batching trackers, which send multiple data points in a single callback event another way you can extend battery life is by stopping sensor tracking when it is not needed, such as when the watch is not being worn this blog describes the “hr tracker” sample application, which implements the batching heart rate tracker in combination with the off-body sensor the application enables heart rate tracking only when the watch is worn if the user tries to start tracking without wearing the watch, they are informed to put it on if the watch is removed during tracking, the tracking is stopped if you have a galaxy watch4 or higher device running wear os powered by samsung, you can download the sample application and test it on your device hr tracker v1 2 0 139 3 kb sep 14 , 2024 prerequisites to implement off-body sensor and heart rate tracking in the application in the androidmanifest xml file for the application, declare the body sensors permission <uses-permission android name="android permission body_sensors" /> in the heartrateactivity java application code file, check whether the user has granted permission to use the body sensors on their galaxy watch if they have not, request it if checkselfpermission manifest permission body_sensors == packagemanager permission_denied { requestpermissions new string[]{manifest permission body_sensors}, offbody_request ; } implementing on and off-body detection to detect when the galaxy watch is being worn on the wrist create an instance of the sensormanager class msensormanager = sensormanager getsystemservice sensor_service ; from the sensormanager class, create an instance of the sensor class that contains the low-latency off-body sensor offbodysensor = msensormanager getdefaultsensor sensor type_low_latency_offbody_detect ; in the onresume method, register an event listener for changes to the offbodysensor value when the application is in the foreground msensormanager registerlistener skintemperatureactivity this, offbodysensor, sensormanager sensor_delay_normal ; in the onpause method, unregister the event listener when the application is in the background msensormanager unregisterlistener this ; override the onsensorchanged method to react to the offbodydata sensor value change when the watch is worn or removed from the wrist because the sensor value is a float, you must convert the value to an integer final float offbodydatafloat = sensorevent values[0]; final int offbodydata = math round offbodydatafloat ; if the value of offbodydata is 1, the watch is being worn we set the variable, which describes worn status, to true deviceworn set true ; if the value of offbodydata is 0, the watch is not being worn set the status variable to false and if measurement was being done at that time - end it and notify the user deviceworn set false ; if ismeasurementrunning get { endmeasurement ; toast maketext this, r string device_removed_during_measurement, toast length_long show ; } in the sample application - a toast message is shown, if the watch is removed while tracker is working watch removed during measurement measuring the heart rate to measure the user’s heart rate check which trackers are supported on the watch using the checkcapabilities method final list<healthtrackertype> availabletrackers = healthtrackingservice gettrackingcapability getsupporthealthtrackertypes ; and return if the heart rate tracker is supported return availabletrackers contains healthtrackertype heart_rate_continuous ; initialize the heart rate tracker heartratetracker = healthtrackingservice gethealthtracker healthtrackertype heart_rate_continuous ; when "measure" button is pressed - check if watch is being worn before starting tracker and cancel execution if its not if !deviceworn get { toast maketext this, r string device_not_worn, toast length_short show ; return; } set an event listener to receive and handle the tracked heart rate data if !ishandlerrunning { heartratehandler post -> heartratetracker seteventlistener heartratelistener ; ishandlerrunning = true; } a listener is an object, which will process incoming data in this blog we will focus on one of the functions included in it - ondatareceived it contains data gathered by the samsung health sensor sdk as list of datapoint type public void ondatareceived @nonnull list<datapoint> list { for datapoint data list { updateheartrate data ; } } for the heart rate sensor, each tracking result consists of a heart rate reading in beats per minute and its status parameter, and a list of inter-beat intervals and the corresponding status for each value because we are interested in the heart rate, extract the beats per minute reading and status final int status = data getvalue valuekey heartrateset heart_rate_status ; int heartratevalue = data getvalue valuekey heartrateset heart_rate ; trackerdatasubject notifyheartratetrackerobservers status, heartratevalue ; if the heart rate reading was successful, the status value is “1” to interpret other status values, see the api documentation display the heart rate and status value on the application screen activityheartratebinding txtheartratebpmvalue settext string format locale getdefault , "%d", heartratevalue ; activityheartratebinding txtheartratestatusvalue settext string format locale getdefault , "%d", status ; "hr tracker" sample application ui if the measurement is stopped by either user input, or watch being removed - stop the heart rate tracker if heartratelistener != null { heartratelistener stoptracker ; } this demonstration has shown how you can combine multiple strategies to enhance battery life when implementing sensor tracking in your watch applications, such as using batching tracker, and to disable tracking when the user is not wearing the device we encourage you to try doing it by yourself and explore other available features provided by samsung health sensor sdk
FAQ health
docfaq what are the main features of the samsung health sensor sdk? the main features of the samsung health sensor sdk include track raw and processed health sensor data on galaxy watch receive data from multiple health sensors for information about the available trackers, see what data is provided the continuous health tracker types are accelerometer heart rate photoplethysmogram ppg skin temperature continuous tracker types measured sensor data and periodically invokes a tracking event listener this enables the watch’s sensor data to be tracked continuously and provide more granular results while conserving battery life how do i get access to the samsung health sensor sdk? you can download the samsung health sensor sdk on the samsung developer site and develop your application and develop the application with enabling the health platform's developer mode to distribute your application using the samsung health sensor sdk, request for the samsung partner program when your request is reviewed, you receive information about how to access the sdk content for more information, see process does the samsung health sensor sdk work on android phones? no the samsung health sensor sdk supports only galaxy watch4 and later models running wear os powered by samsung it does not support other mobile devices, such as smartphones can supported health tracker types of the samsung health sensor sdk differ depending on the galaxy watch model or wear os version? yes the supported health tracker types can differ depending on the specific galaxy watch model and the watch software version the samsung health sensor sdk provides a capability check api it retrieves which tracker types are available on the user’s watch and can therefore be used by your application can i read data from more than 1 health tracker type simultaneously? yes, depending on the tracker type there are 2 tracker types on-demand tracker type, such as bia body composition and ecg electrocardiogram continuous tracker type, such as accelerometer and heart rate only 1 on-demand tracker type can be used at a time multiple continuous tracker types can be used simultaneously the measure blood oxygen level and heart rate on galaxy watch code lab demonstrates how to implement running on-demand and continuous tracker types is an emulator available for developing applications with the samsung health sensor sdk? no the samsung health sensor sdk doesn't support the emulator development with the sdk requires the galaxy watch device can i detect when users take the galaxy watch off their wrist? yes, depending on the tracker for the heart rate, spo2, bia body composition , and sweat loss trackers, you can use the samsung health sensor sdk to monitor the status field with the update listener for example, a heart rate status value of “-3” means that the wearable is not being worn for information about other status values and trackers, refer to the api reference alternatively, you can check the sensor type_low_latency_offbody_detect value for more information, see heart rate tracking with the off-body sensor does the samsung health sensor sdk receive its data through samsung health? no the samsung health sensor sdk does not share data with samsung health health services also provides heart rate tracking how is heart rate tracking with the samsung health sensor sdk different? the samsung health sensor sdk provides heart rate data tracking with ibi inter-beat interval , which can be used to calculate hrv heart rate variability this information can be used for more detailed analysis the android sensor manager also provides accelerometer tracking how is accelerometer tracking with the samsung health sensor sdk different? the accelerometer tracking provided by the samsung health sensor sdk records data samples with 25hz resolution continuously the sdk 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
Develop Health
docrelease note release date september 22, 2024 release version v1 3 0 target device the samsung health sensor sdk are supported on the following watch devices that run on wear os powered by samsung galaxy watch4 series and later models sdk content content description documents api reference programming guide library tracking library of the samsung health sensor sdk import it in your app project samsung-health-sensor-api aar sample apps measure blood oxygen measure blood oxygen and heart rate heart rate tracker transfer measured heart rate to a connected phone measure skin temperature ecg monitor sweat loss monitor features the tracking apis of the samsung health sensor sdk enable partner application to register an event for tracking health sensor data and to retrieve that data while tracking on a galaxy watch capabilities the samsung health sensor sdk provides the available tracker types on the watch measuring watch’s health sensor data a partner application using the sdk can measure health-sensor data of a galaxy watch the following tracker types are supported [continuous tracker types] the following tracker types can be measured continuously until unsetting the tracker type’s event listener continuous tracker types operate with low battery consumption of the galaxy watch accelerometer heart rate including ibi inter-beat interval photoplethysmogram ppg green, infrared ir , and red skin temperature [on-demand tracker types] the following tracker types are on-demand tracker types use only one on-demand tracker type at a time and only when needed bioelectrical impedance analysis bia electrocardiogram ecg ppg green, infrared ir , and red skin temperature spo2 blood oxygen [other] measuring the user’s sweat loss amount after a running is available with the following tracker type sweat loss developer mode a developer mode is supported for testing and debugging see the developer mode for more information restrictions the emulator is not supported data measured by the samsung health sensor sdk is for fitness and wellness information only, not for the diagnosis or treatment of any medical condition changes 1 3 0 - september 22, 2024 rebranding the sdk name to "samsung health sensor sdk" 1 3 0 - august 22, 2024 [new] continuous and on-demand enum constant names of healthtrackertype have been defined accelerometer_continuous bia_on_demand ecg_on_demand heart_rate_continuous ppg_continuous ppg_on_demand skin_temperature_on_demand spo2_on_demand an application can track one or more ppgtypes with ppg_continuous or ppg_on_demand the following api has been added healthtrackingservice gethealthtracker healthtrackertype, set<ppgtype> the following ppg types have been added ppgtype green ppgtype ir ppgtype red valuekey ppgset has been added it includes ppg green, ir, red data the following fields for bia’s raw data have been added in valuekey biaset body_impedance_degree body_impedance_magnitude [deprecated] the following enum constant names of healthtrackertype have been deprecated accelerometer use accelerometer_continuous bia use bia_on_demand ecg use ecg_on_demand heart_rate use heart_rate_continuous ppg_green use ppg_continuous ppg_ir use ppg_on_demand ppg_red use ppg_on_demand skin_temperature use skin_temperature_on_demand spo2 use spo2_on_demand the following ppg data set of valuekey have been deprecated use valuekey ppgset instead of them valuekey ppggreenset valuekey ppgirset valuekey ppgredset [removed] the following fields of valuekey ecgset have been removed use alternative fields valuekey ecgset ecg use valuekey ecgset ecg_mv valuekey ecgset max_threshold use valuekey ecgset max_threshold_mv valuekey ecgset min_threshold use valuekey ecgset min_threshold_mv the following fields of valuekey heartrateset have been removed use alternative fields valuekey heartrateset heart_rate_ibi use valuekey heartrateset ibi_list valuekey heartrateset status use valuekey heartrateset heart_rate_status and valuekey heartrateset ibi_status_list 1 2 0 - august 30, 2023 [new] the skin temperature tracker type and data point set have been added skin temperature can be measured on-demand or as a batching event for more information, see the api reference healthtrackertype skin_temperature healthtrackertype skin_temperature_continuous valuekey skintemperatureset the following interfaces for values in millivolts have been added to the ecg data point set ecg_mv max_threshold_mv min_threshold_mv the following interfaces for heart rate status and ibi-related information have been added to the heart rate data point set valuekey heartrateset heart_rate_status valuekey heartrateset ibi_list valuekey heartrateset ibi_status_list the status interface has been added to the following data point sets valuekey accelerometerset status valuekey ppggreenset status valuekey ppgirset status valuekey ppgredset status [change] the error description of the first bit in the 1 ~ 127 value for valuekey sweatlossset status has been updated [deprecated] the following interfaces in the ecg data point set have been deprecated valuekey ecgset ecg, replaced by valuekey ecgset ecg_mv valuekey ecgset max_threshold, replaced by valuekey ecgset max_threshold_mv valuekey ecgset min_threshold, replaced by valuekey ecgset min_threshold_mv the following interfaces in the heart rate data point set have been deprecated valuekey heartrateset heart_rate_ibi, replaced by valuekey heartrateset ibi_list valuekey heartrateset status, replaced by valuekey heartrateset heart_rate_status and valuekey heartrateset ibi_status_list [removed] valuekey heartrateset flag has been removed 1 1 0 - march 31, 2022 minor stability improvements have been made to the sdk library 1 1 0 alpha - march 17, 2022 [new] the spo2 tracker type and data point set have been added, which are supported by health platform v1 3 0 healthtrackertype spo2 valuekey spo2set valuekey heartrateset status has been added, which replaces valuekey heartrateset flag [changes] the trackingsampleapp application code has been updated [deprecated] valuekey heartrateset flag has been deprecated 1 0 0 - feb 25, 2022 the values for sweatlossset status have changed for more information, see the api reference 1 0 0 beta1 - dec 31, 2021 minor issues related to the sweat loss feature have been fixed 1 0 0 alpha3 - dec 17, 2021 [new] the sweat loss feature has been added, which measures how much sweat is lost during a run the following interfacess have been added datatype enum exercisestate enum exercisetype enum healthtrackertype sweat_loss enum vale healthtrackingservice gethealthtracker healthtrackertype healthtrackertype, trackeruserprofile userprofile, exercisetype type api valuekey sweatlossset class [known issue] the following issues are to be resolved in february 2022 watch software update a timestamp period variation issue in received sensor data for accelerometer, heart rate and ppg grenn an issue where healthtracker trackereventlistener onflushcompleted is not received 1 0 0 alpha2 - july 28, 2021 [change] the sdk policy has been applied tracking watch sensor data with the sdk is available only for the tracking types within the registered scope if sdk_policy_error occurs, talk to your samsung contact point the following interfaces have been added to the tracking data point sets the bia status has been defined valuekey biaset status check this value after a bia measurement if the status indicates an error, guide the user with a message and appropriate ui the ecg’s lead on/off values have been defined valuekey ecgset lead_off the flag for heart rate measurement has been added valuekey heartrateset flag in healthtracker trackererror the following unused errors have been removed low_signal movement_detected not_wearing time_out the following error has been added sdk_policy_error measurement guides for each sensor data have been added to the programing guide
Develop Health
apioverviewpackageclasstreedeprecatedindex com samsung android sdk healthdata interface healthconstants exercise all superinterfaces healthconstants common, healthconstants sessionmeasurement enclosing class healthconstants public static interface healthconstants exercise extends healthconstants sessionmeasurement this interface defines exercise data of the user properties properties of the following extending interfaces are available for this data type healthconstants common healthconstants sessionmeasurement exercise data has the following properties see more common properties by spreading this section out property name description healthconstants exercise uuid [mandatory] data's unique id, assigned by the system when a new data is inserted healthconstants exercise create_time [mandatory] utc milliseconds when a data is created in the health data store, assigned by the system when a new data is inserted healthconstants exercise update_time [mandatory] utc milliseconds when a data is updated in the health data store, assigned by the system when a new data is inserted or the existing data is updated healthconstants exercise package_name [mandatory] package name which provides data, assigned by the system when a new data is inserted healthconstants exercise device_uuid [mandatory] device identifier which provides the health data healthconstants exercise start_time [mandatory] utc milliseconds when the measurement is started healthconstants exercise end_time [mandatory] utc milliseconds after the measurement has ended if the samsung health's exercise data has the same start_time and end_time, it means the user didn't select the "pause" or "stop" button yet on samsung health healthconstants exercise time_offset [mandatory] time offset in milliseconds which considers the time zone and daylight saving time healthconstants exercise exercise_type [mandatory] predefined exercise type healthconstants exercise exercise_custom_type custom exercise type healthconstants exercise calorie [mandatory] burned calorie healthconstants exercise duration [mandatory] duration of this exercise healthconstants exercise distance distance healthconstants exercise altitude_gain increased altitude during the activity healthconstants exercise altitude_loss decreased altitude during the activity healthconstants exercise count count of a repetitive action healthconstants exercise count_type type of the count healthconstants exercise max_speed maximum speed healthconstants exercise mean_speed mean speed healthconstants exercise max_caloricburn_rate maximum rate of burned calories healthconstants exercise mean_caloricburn_rate mean rate of burned calories healthconstants exercise max_cadence maximum cadence rate healthconstants exercise mean_cadence mean cadence rate healthconstants exercise max_heart_rate maximum heart rate healthconstants exercise mean_heart_rate mean heart rate healthconstants exercise min_heart_rate minimum heart rate healthconstants exercise max_altitude maximum altitude healthconstants exercise min_altitude minimum altitude healthconstants exercise incline_distance uphill distance healthconstants exercise decline_distance downhill distance healthconstants exercise max_power maximum power healthconstants exercise mean_power mean power healthconstants exercise mean_rpm mean rpm revolutions per minute healthconstants exercise max_rpm max rpm revolutions per minute healthconstants exercise live_data live data e g heart rate, speed, power, and so on during exercise healthconstants exercise location_data location trajectory data during exercise healthconstants exercise vo2_max maximal oxygen consumption during exercise healthconstants exercise comment comment healthconstants exercise additional additional info to express exercise's details healthconstants exercise custom custom info which is formatted with json and compressed data data permission the user's consent is required to read or write this data type healthpermissionmanager requestpermissions displays a data permission ui to the user see permission manager and request data permission since 1 0 0 field summary fields modifier and type field and description static string additional additional info to express exercise's details static string altitude_gain increased altitude during the activity in meters static string altitude_loss decreased altitude during the activity in meters static string calorie burned calorie during the activity in kilocalories static string comment comment for data static string count count of a repetitive action, such as the revolution count of the bicycle pedal or striding count of a runner or walker static string count_type type of the count static int count_type_repetition general repetition type static int count_type_stride stride or step cadence type static int count_type_stroke stroke cadence type static int count_type_swing swing cadence type static string decline_distance downhill distance during the activity in meters static string distance distance covered during the exercise in meters static string duration duration of this exercise in milliseconds static string exercise_custom_type custom exercise type static string exercise_type predefined exercise type static string health_data_type data type name for exercise static string incline_distance uphill distance during the activity in meters static string live_data live data e g heart rate, speed, power, and so on during exercise which is formatted with json and compressed data static string location_data location trajectory data during exercise which is formatted with json and compressed data static string max_altitude maximum altitude in meters static string max_cadence maximum cadence rate per minute static string max_caloricburn_rate maximum rate of burned calories in kilocalories per hour static string max_heart_rate maximum heart rate per minute static string max_power maximum power in watts static string max_rpm max rpm revolutions per minute static string max_speed maximum speed in meters per second static string mean_cadence mean cadence rate per minute static string mean_caloricburn_rate mean rate of burned calories in kilocalories per hour static string mean_heart_rate mean heart rate per minute static string mean_power mean power in watts static string mean_rpm mean rpm revolutions per minute static string mean_speed mean speed in meters per second static string min_altitude minimum altitude in meters static string min_heart_rate minimum heart rate per minute static string vo2_max maximal oxygen consumption during exercise fields inherited from interface com samsung android sdk healthdata healthconstants sessionmeasurement end_time, start_time, time_offset fields inherited from interface com samsung android sdk healthdata healthconstants common create_time, custom, device_uuid, package_name, update_time, uuid field detail exercise_type static final string exercise_type predefined exercise type your application's exercise data is shown on samsung health if the data sets this value if you cannot find a proper exercise type in predefined types, set the value as 0 and set exercise_custom_type instead of it mandatory type int available values predefined types since 1 0 0 see also constant field values exercise_custom_type static final string exercise_custom_type custom exercise type define its value as fqdn, e g "com yourcompany exercise type exercise_name" this property has to be used only when you cannot find a required exercise type in predefined types if this custom type is used, set the value of exercise_type as 0 your custom health data is inserted to the health data store but it is not shown in samsung health optional type string value length 1 ~ 255 since 1 0 0 see also constant field values distance static final string distance distance covered during the exercise in meters optional type float value range 0 ~ 2000000 since 1 0 0 see also constant field values calorie static final string calorie burned calorie during the activity in kilocalories mandatory type float value range 0 ~ 1000000 since 1 0 0 see also constant field values duration static final string duration duration of this exercise in milliseconds mandatory type long value range 0 ~ 86400000 since 1 0 0 see also constant field values altitude_gain static final string altitude_gain increased altitude during the activity in meters optional type float value range 0 ~ 10000 since 1 0 0 see also constant field values altitude_loss static final string altitude_loss decreased altitude during the activity in meters optional type float value range 0 ~ 10000 since 1 0 0 see also constant field values count static final string count count of a repetitive action, such as the revolution count of the bicycle pedal or striding count of a runner or walker optional type int value range 0 ~ 1000000 since 1 0 0 see also count_type, constant field values count_type static final string count_type type of the count optional type int available values one of the following values count_type_stride count_type_stroke count_type_swing count_type_repetition since 1 0 0 see also constant field values count_type_stride static final int count_type_stride stride or step cadence type its constant value is 30001 since 1 0 0 see also count_type, constant field values count_type_stroke static final int count_type_stroke stroke cadence type its constant value is 30002 since 1 0 0 see also count_type, constant field values count_type_swing static final int count_type_swing swing cadence type its constant value is 30003 since 1 0 0 see also count_type, constant field values count_type_repetition static final int count_type_repetition general repetition type its constant value is 30004 since 1 3 0 see also count_type, constant field values max_speed static final string max_speed maximum speed in meters per second optional type float value range 0 ~ 140 since 1 0 0 see also constant field values mean_speed static final string mean_speed mean speed in meters per second optional type float value range 0 ~ 140 since 1 0 0 see also constant field values max_caloricburn_rate static final string max_caloricburn_rate maximum rate of burned calories in kilocalories per hour optional type float value range 0 ~ 1000000 since 1 0 0 see also constant field values mean_caloricburn_rate static final string mean_caloricburn_rate mean rate of burned calories in kilocalories per hour optional type float value range 0 ~ 1000000 since 1 0 0 see also constant field values max_cadence static final string max_cadence maximum cadence rate per minute e g the cadence indicates steps per minute for running exercise optional type float value range 0 ~ 500000 since 1 0 0 see also constant field values mean_cadence static final string mean_cadence mean cadence rate per minute e g the cadence indicates steps per minute for running exercise optional type float value range 0 ~ 500000 since 1 0 0 see also constant field values max_heart_rate static final string max_heart_rate maximum heart rate per minute optional type float value range 0 ~ 300 since 1 0 0 see also constant field values mean_heart_rate static final string mean_heart_rate mean heart rate per minute optional type float value range 0 ~ 300 since 1 0 0 see also constant field values min_heart_rate static final string min_heart_rate minimum heart rate per minute optional type float value range 0 ~ 300 since 1 2 0 see also constant field values max_altitude static final string max_altitude maximum altitude in meters optional type float value range -1000 ~ 10000 since 1 0 0 see also constant field values min_altitude static final string min_altitude minimum altitude in meters optional type float value range -1000 ~ 10000 since 1 0 0 see also constant field values incline_distance static final string incline_distance uphill distance during the activity in meters optional type float value range 0 ~ 1000000 since 1 0 0 see also constant field values decline_distance static final string decline_distance downhill distance during the activity in meters optional type float value range 0 ~ 1000000 since 1 0 0 see also constant field values max_power static final string max_power maximum power in watts optional type float value range 0 ~ 999 since 1 0 0 see also constant field values mean_power static final string mean_power mean power in watts optional type float value range 0 ~ 999 since 1 0 0 see also constant field values mean_rpm static final string mean_rpm mean rpm revolutions per minute optional type float value range 0 ~ 100000 since 1 2 1 see also constant field values max_rpm static final string max_rpm max rpm revolutions per minute optional type float value range 0 ~ 100000 since 1 3 0 see also constant field values live_data static final string live_data live data e g heart rate, speed, power, and so on during exercise which is formatted with json and compressed data optional type byte[] maximum data size 1000 kb live data can have one or more segments e g samsung health starts the exercise data record when the user starts a specified exercise it makes several segments to live data for each specific period when the user tabs the 'stop' button finally it finishes the exercise data record each segment is composed of the following json keys json key type unit mandatory "start_time" long utc millisecond recommended set this value if you save live_data "heart_rate" float beat per minute recommended set one or more values if you save live_data "cadence" float rate per minute "count" int - "power" float watt "speed" float meter per second "distance" float meter the following example shows the json format for live_data { "start_time" 1422457096536, "heart_rate" 147 48181, "cadence" 95 84712, "count" 83, "power" 99 50436, "speed" 11 061617, "distance" 250 } especially, each segment's "count" and "distance" in live data are accumulated values to the each segment's "start_time"unlike other values such as "heart_rate" and "cadence" that indicate the measured value at the point of each segment's "start_time" compressed json conversion can be converting data to compressed json getting data from compressed json since 1 0 0 see also healthdatautil, constant field values location_data static final string location_data location trajectory data during exercise which is formatted with json and compressed data it follows wgs 84 optional type byte[] maximum data size 1000 kb location data can have one or more segment each segment is composed of the following json keys json key type mandatory "start_time" long recommended,set this value if you save location_data "latitude" float recommended,set this value if you save location_data "longitude" float recommended,set this value if you save location_data "altitude" float no "accuracy" float no the following example shows the json format for location_data { "start_time" 1422457096536, "latitude" 2 7413864, "longitude" 60 37224, "altitude" 39 0, "accuracy" 0 0 } compressed json conversion can be converting data to compressed json getting data from compressed json since 1 0 0 see also healthdatautil, constant field values vo2_max static final string vo2_max maximal oxygen consumption during exercise optional type float value range 0 ~ 100 since 1 5 0 see also constant field values comment static final string comment comment for data optional type string value length 0 ~ 255 since 1 0 0 see also constant field values additional static final string additional additional info to express exercise's details it is formatted with json and compressed data it's different for each exercise kind compressed json conversion can be converting data to compressed json getting data from compressed json swimming's additional info swimming's detailed information is defined with the following json keys json key type unit mandatory remarks "pool_length" int - yes 20 | 50 | "pool_length_unit" string - yes one of the following value "meter" "yard" "total_distance" float meter yes "total_duration" int millisecond yes "lengths" array - no array of length a length is the distance from one end of a swimming pool to the other each length's detailed information is defined with the following json keys json key type unit mandatory description "duration" int millisecond yes duration value of this length "stroke_count" int - yes stroke count value of this length "stroke_type" string - yes stroke type value of this length one of the following value "freestyle" "butterfly" "backstroke" "breaststroke" "mixed" "interval" int - yes interval value it starts from 1 and increments by 1 see swimming data's example additional info { "pool_length" 25, "pool_length_unit" "meter", "total_distance" 125, "total_duration" 247000, "lengths" [ { "duration" 49000, "interval" 1, "stroke_count" 20, "stroke_type" "butterfly" }, { "duration" 42000, "interval" 1, "stroke_count" 21, "stroke_type" "backstroke" }, { "duration" 51000, "interval" 1, "stroke_count" 26, "stroke_type" "breaststroke" }, { "duration" 52000, "interval" 2, "stroke_count" 27, "stroke_type" "freestyle" }, { "duration" 53000, "interval" 2, "stroke_count" 29, "stroke_type" "mixed" } ] } since 1 3 0 see also constant field values health_data_type static final string health_data_type data type name for exercise use "com samsung health exercise" to add permission to the manifest file since 1 0 0 see also constant field values
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.
These cookies gather information about your browser habits. They remember that you've visited our website and share this information with other organizations such as advertisers.
You have successfully updated your cookie preferences.