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
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 overview 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.
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
apioverview package class tree deprecated index 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.