• Learn
    • Code Lab
    • Foldables and Large Screens
    • One UI Beta
    • Samsung Developers Podcasts
  • Develop
    • Mobile/Wearable
    • Galaxy GameDev
    • Galaxy Themes
    • Galaxy Watch
    • Health
    • Samsung Blockchain
    • Samsung DeX
    • Samsung IAP
    • Samsung Internet
    • Samsung Pay
    • Samsung Wallet
    • View All
      • Galaxy AR Emoji
      • Galaxy Accessory
      • Galaxy Edge
      • Galaxy Z
      • Galaxy Performance
      • Galaxy FM Radio
      • Galaxy S Pen Remote
      • Galaxy Sensor Extension
      • PENUP
      • Samsung Automation
      • Samsung Neural
      • Samsung TEEGRIS
      • Samsung eSE SDK
    • Visual Display
    • Smart TV
    • Smart Hospitality Display
    • Smart Signage
    • Digital Appliance
    • Family Hub
    • Platform
    • Bixby
    • Knox
    • SmartThings
    • Tizen.NET
  • Design
    • Design System
    • One UI
    • One UI Watch
    • Smart TV
  • Distribute
    • Galaxy Store
    • TV Seller Office
    • Galaxy Store Games
    • Samsung Podcasts
  • Support
    • Developer Support
    • Remote Test Lab
    • Issues and Bugs Channel
    • Samsung Android USB Driver
    • Galaxy Emulator Skin
  • Connect
    • Blog
    • News
    • Forums
    • Events
    • Samsung Developer Conference
    • SDC22
    • SDC21
    • SDC19 and Previous Events
  • Sign In
Top Global Search Form
Recommendation
  • Blog
  • Code Lab
  • Foldable and Large Screen Optimization
  • Forums
  • Galaxy Emulator Skin
  • Galaxy GameDev
  • Health
  • Remote Test Lab
  • Samsung Developer Conference
  • SDC22
  • Watch Face Studio
All Search Form
Recommendation
    Suggestion
      All Search Form
      Filter
      Filter
      Filter
      • ALL (100)
      • DOCS
      • SDK
      • API REFERENCE
      • CODE LAB
      • BLOG
      • NEWS/EVENTS
      • OTHERS
        api reference code lab blog news/events
      1. Develop
      2. Health

      api

      HealthDataStore

      overview package class tree deprecated index com.samsung.android.sdk.healthdata class healthdatastore java.lang.object com.samsung.android.sdk.healthdata.healthdatastore public class healthdatastore extends object this class provides connection to the health data store. app manifest from android 11, add the following element in your app's manifest. otherwise, a connection with samsung health fails. <manifest . . . > <queries> <package android:name="com.sec.android.app.shealth" /> </queries> </manifest> data store connection health data in the health data store can be accessed after getting connection with the health data store. healthdatastore requests to connect or disconnect with the health data store and its result can be checked with healthdatastore.connectionlistener. an example below shows how to request connection to the health data store and check the result. public class mainactivity extends activity { // the state of connection private healthdatastore mstore; private static final string app_tag = "myapp"; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); connect(); } @override public boolean oncreateoptionsmenu(menu menu) { // inflate the menu; this adds items to the action bar if it is present. getmenuinflater().inflate(r.menu.main, menu); return true; } @override public boolean onoptionsitemselected(menuitem item) { // handle action bar item clicks here. the action bar will // automatically handle clicks on the home/up button, so long // as you specify a parent activity in androidmanifest.xml. int id = item.getitemid(); if (id == r.id.action_settings) { return true; } return super.onoptionsitemselected(item); } public healthdatastore connect() { // connect to the health data store mstore = new healthdatastore(this, mcntlistener); try { mstore.connectservice(); } catch (exception e) { log.d(app_tag, "connection fails."); e.printstacktrace(); } return mstore; } private final healthdatastore.connectionlistener mcntlistener = new healthdatastore.connectionlistener() { @override public void onconnected() { log.d(app_tag, "health data service is connected."); } @override public void onconnectionfailed(healthconnectionerrorresult error) { if (error.hasresolution()) { // resolve an error } else { log.d(app_tag, "health data service is not available."); } } @override public void ondisconnected() { log.d(app_tag, "health data service is disconnected."); } }; } since: 1.0.0 nested class summary nested classes modifier and type class and description static interface healthdatastore.connectionlistener this interface provides the callback when the client is connected or disconnected with the health data store. constructor summary constructors constructor and description healthdatastore(context context, healthdatastore.connectionlistener listener) constructs and initializes an instance of healthdatastore with a context and listener. method summary all methods instance methods concrete methods modifier and type method and description void connectservice() connects your application to the health data store. void connectservice(long timeout) connects your application to the health data store for the given connection timeout. void disconnectservice() disconnects your application from the health data store. constructor detail healthdatastore public healthdatastore(context context, healthdatastore.connectionlistener listener) constructs and initializes an instance of healthdatastore with a context and listener. parameters: context - the context of application listener - the listener that is implemented to receive the result of the connection or disconnection request. throws: illegalargumentexception - if the given context or listener is null since: 1.0.0 method detail connectservice public void connectservice() connects your application to the health data store. it tries connection for one minute in default. if you want to set a connection timeout differently, use connectservice(long). the connection result can be checked in the following handlers. healthdatastore.connectionlistener.onconnected() is invoked if it succeeds. healthdatastore.connectionlistener.onconnectionfailed(healthconnectionerrorresult) is invoked if it fails. throws: illegalstateexception - if the instance is not constructed with a valid context instance since: 1.0.0 connectservice public void connectservice(long timeout) connects your application to the health data store for the given connection timeout. the connection result can be checked in the following handlers. healthdatastore.connectionlistener.onconnected() is invoked if it succeeds. healthdatastore.connectionlistener.onconnectionfailed(healthconnectionerrorresult) is invoked if it fails. parameters: timeout - the timeout value in milliseconds for connection to health data store. if connection doesn't succeed in timeout, healthdatastore.connectionlistener.onconnectionfailed(healthconnectionerrorresult) is invoked. throws: illegalstateexception - if the instance is not constructed with a valid context instance since: 1.0.0 disconnectservice public void disconnectservice() disconnects your application from the health data store. note that healthdatastore.connectionlistener.ondisconnected() is not invoked after calling this method. since: 1.0.0

      https://developer.samsung.com/health/android/data/api-reference/com/samsung/android/sdk/healthdata/HealthDataStore.html
      1. Develop
      2. Health

      doc

      Release Note

      release note introduction release date: nov 3, 2020 release contents content description libraries libraries to sync health data with samsung health sample sample app codes with simplehealth, stepdiary, and foodnote tool dataviewer to test a created app documents api reference, programming guide change history jan 14, 2021 service package removal from samsung health v6.15, the service package doesn't work. the data library is not changed. nov 3, 2020 data 1.5.0 [changes] data library the data library is provided with 'aar' from 1.5.0. compatible samsung health version samsung health 6.12 or above works with the data package 1.5.0. data types "com.samsung.shealth.step_daily_trend" is defined with a new interface. use healthconstants.stepdailytrend instead of it. the new interface doesn't affect to existing apps that use "com.samsung.shealth.step_daily_trend". vo2_max is added to healthconstants.exercise. data viewer tool removing electrocardiogram and healthdocument from a data type list. [deprecation] healthconstants.electrocardiogram is deprecated. august 7, 2020 [changes] developer mode from samsung health 6.11, the developer mode needs a dev access key. see developer mode guide. data viewer tool dataviewer is updated with reading data only. stepdiary sample app it is provided with kotlin. june 22, 2020 service package - deprecated the service package is deprecated. do not use this feature any more. nov 28, 2019 service 1.4.0 [android 10 support] in samsung health 6.8, trackermanager.startactivity() is updated for android 10 to work well even samsung health is on the background. [deprecation] the following trackers are deprecated in trackermanager.trackerid. spo2 thermo_hygrometer uv apr 11, 2019 data 1.4.0 [important notice] data 1.4.0 library includes important changes. all partner app must use this version until july 2019. otherwise, your app will do not work with samsung health properly. it supports security enhancements in android 8.0. applications that target android 9 or higher cannot share data with other applications using socket. it works with samsung health 6.2 or above. healthconnectionerrorresult.old_version_platform must be handled to install the latest samsung health. update your app by applying all changes below to make a seamless service. [new] healthconstants.nutrition a nutrition data type is added. replace healthconstants.foodinfo & healthconstants.foodintake to healthconstants.nutrition. they will be removed in the next release. [deprecation & behavior changes] healthdataservice is deprecated. call just healthdatastore.connectservice() without after calling healthdataservice.initialize(). remove sdk-v1.0.0.jar. healthuserprofile’s some apis are deprecated and have a behavior change. getuserid() is not valid anymore. its behavior is changed to return an empty string for privacy policy enhancement. it will be removed in the next release. getimage() is not valid anymore. its behavior is changed to return null for privacy policy enhancement. it will be removed in the next release. healthdataresolver's inserting and updating data apis have a behavior change: `healthdataresolver.insert()` <br> `healthdataresolver.update()` <br> `healthdataresolver.insertwithpermission()` - `illegalargumentexception` is returned only if the request contains invalid instance type. - check the result with `getstatus()` of `healthresultholder.baseresult`. a data validation error is received as `status_invalid_input_data` in `healthresultholder.resultlistener.onresult()`. the data validation includes missing mandatory fields, wrong field type, out of the data value range and oversized blob. - see its [example](https://img-developer.samsung.com/onlinedocs/health/android/data/com/samsung/android/sdk/healthdata/healthdataresolver.insertrequest.html). [sample & tool update] sample apps foodnote is updated as replacing healthconstants. healthconstants.foodinfo and healthconstants.foodintake to healthconstants.nutrition. stepdiary's typo is fixed. dataviewer a data type list is updated with healthconstants.nutrition. healthconstants.foodinfo and healthconstants.foodintake is dropped out. sep 13, 2018 service 1.3.1 trackermanager.destination reward destination is deprecated. it goes to an error page from samsung health 6.0. trackertile setting date and content color in a tracker tile is not available from samsung health 6.0. setdate() is deprecated. setcontentcolor() is deprecated. tracker design guide is updated. may 25, 2018 data 1.3.0 daily step count trend ("com.samsung.shealth.step_daily_trend") "1" and "2" source type values that indicate wearable and activity trackers are deprecated. see deprecated info here. the data library is same. jan 11, 2018 data 1.3.0 healthconstants.foodinfo deprecated as he data library is same. do not use it any more. it will be removed. healthconstants.foodintake food_info_id is deprecated. oct 26, 2017 service 1.3.0 trackermanager.trackerid added. the existing fields for samsung health's trackers are deprecated. use the new class fields. jumping to a tracker's specific destination like trends is available. trackermanager.destination added. a new startactivity() api that has a destination param is added to trackermanager. sample app is updated to sampleservice. for more detailed information, refer to here. oct 17, 2017 the sdk name became "samsung health android sdk". aug 24, 2017 dataviewer tool is updated. a minor defect is patched. jul 27, 2017 data 1.3.0 new data types supported data types are added including floors climbed and health document. instant permission instant permission apis to handle health document are added. some properties are added: healthconstants.common: custom healthconstants.exercise: additional, max_rpm healthconstants.heartrate: min, max, binning_data healthconstants.weight: body_fat_mass, fat_free, fat_free_mass, skeletal_muscle_mass, total_body_water healthdata apis to handle inputstream are added. setlocaltimerange() is added to handle the local time zone change easily. healthdataresolver.aggregaterequest.builder healthdataresolver.readrequest.builder iterator() and close() are added to healthdataresolver.aggregateresult. more health data units are added. healthdatautil class is added. a new sample app stepdiary is added. the dataviewer tool is updated. more supported data types are added. the user interfaces are improved. for more detailed information, refer to here. apr 27, 2017 some terms are changed: "s health" app name is rebranded to "samsung health". "samsung health sdk" is used for the sdk’s name instead of "samsung digital health sdk". only the library names are changed according to the sdk naming. you don’t need to update your app. sample apps are updated by the changed terms. related documents are updated by the changed terms. jun 23, 2016 service 1.2.0 apis for the feature availability check are added in the shealth class. feature_tracker_launch feature_tracker_tile isfeatureenabled(int...) shealth.isfeatureenabled(int) was the default implementation and didn't work. it is updated to check the feature availability. to launch the s health’s specific tracker with trackerinfo and trackermanager, s health 4.8 or above is needed. feb 25, 2016 data 1.2.1 a new meal type, meal_type_before_sleep is added to healthconstants.bloodglucose. mean_rpm is added to healthconstants.exercise. in 1.2.0, healthconnectionerrorresult.unknown had been retrieved when s health prior to 4.6 is installed on the device. in this release, a bug for the wrong error value is fixed to give healthconnectionerrorresult.old_version_platform. you can solve the error situation by calling healthconnectionerrorresult.resolve(). the following apis are deprecated: healthresultholder.cancel() healthresultholder.baseresult.status_canceled nov 26, 2015 data 1.2.0 healthdevapp is removed. use dataviewer to test your application. "com.samsung.android.health.platform_type" in manifest to use healthdevapp is not required. to make a clear operation after the permission ui is popped up, the existing permissionmanager.requestpermissions() is deprecated. use new api with the activity parameter instead of it. connectservice() with the timeout parameter is added to healthdatastore. healthconstants.sleepstage to present detailed sleep data is added. body fat, skeletal muscle, muscle mass, and basal metabolic rate properties are added to healthconstants.weight. the minimum heart rate property is added to healthconstants.exercise. the user name and user’s picture image can be retrieved through healthuserprofile. for more detailed information, refer to here. service 1.1.0 s health simulator is removed from the sdk tool because s health’s available devices had been expanded. shealth.initialize() doesn’t throw ssdkunsupportedexception and securityexception. com.samsung.android.providers.context.permission.write_use_app_feature_survey permission is not required. the title of tile design guidelines is changed to tracker design guidelines. jun 18, 2015 data 1.1.0 sample application projects are updated to import them on android studio. healthconnectionerrorresult the device that supports s health 4.x can be checked with hasresolution(). hasresolution() and resolve() require the android.permission.internet permission. healthconstants.bloodglucose meal_type before_meal and meal_type general are added. meal_type_after_bedtime is deprecated. "treadmill" and "elliptical trainer" are added to the predefined type of healthconstants.exercise. putnull() to set a value of data property as null is added to healthdata. available ranges or operations of some apis are changed. for more detailed information, refer to here. mar 31, 2015 data 1.0.0 healthconnectionerrorresult.resolve()'s operation is changed without a dialog. some constants for unit are added and descriptions of healthconstants interfaces are changed. if the handler parameter of the healthdataobserver’s constructor is null, the looper of the current thread will be used for the callback. a permissible range of medical data for countries is expanded. for more detailed information, refer to here. service 1.0.0 guide for trackereventlistener is supplemented. check your application after referring to the api reference and programming guide. description of tile design guideline for tracker is supplemented. the icon size of tracker_tile_type_1 is changed to 60. known issues none features health data store handles the service connection. inserts, reads, updates and deletes health data. health data type predefined data types such as counting steps or nutrition. data permission checks and requests permissions to handle health data.

      https://developer.samsung.com/health/android/release-note.html
      1. Develop
      2. Health

      api

      HealthDataStore.ConnectionListener

      overview package class tree deprecated index com.samsung.android.sdk.healthdata interface healthdatastore.connectionlistener enclosing class: healthdatastore public static interface healthdatastore.connectionlistener this interface provides the callback when the client is connected or disconnected with the health data store. since: 1.0.0 method summary all methods instance methods abstract methods modifier and type method and description void onconnected() called when a connection to the health data store has been established. void onconnectionfailed(healthconnectionerrorresult error) called when a connection to the health data store has failed. void ondisconnected() called when a connection to the health data store has been lost. method detail onconnected void onconnected() called when a connection to the health data store has been established. it is invoked after creating a healthdatastore instance. since: 1.0.0 onconnectionfailed void onconnectionfailed(healthconnectionerrorresult error) called when a connection to the health data store has failed. note that it is invoked after creating a healthdatastore instance. since: 1.0.0 ondisconnected void ondisconnected() called when a connection to the health data store has been lost. note that it is not invoked caused by healthdatastore.disconnectservice(). it is only invoked if the health data service crashes. since: 1.0.0

      https://developer.samsung.com/health/android/data/api-reference/com/samsung/android/sdk/healthdata/HealthDataStore.ConnectionListener.html
      1. Develop
      2. Health

      api

      HealthDataResolver.UpdateRequest.Builder

      overview package class tree deprecated index com.samsung.android.sdk.healthdata class healthdataresolver.updaterequest.builder java.lang.object com.samsung.android.sdk.healthdata.healthdataresolver.updaterequest.builder enclosing interface: healthdataresolver.updaterequest public static class healthdataresolver.updaterequest.builder extends object this class is a builder to configure healthdataresolver.updaterequest. only inserted health data by your application can be updated. the following example shows how to update calrories of existing health data. public class healthdataresolverexample { private healthdataresolver.updaterequest buildupdaterequest() { healthdevice mydevice = new healthdevicemanager(mstore).getlocaldevice(); healthdata data = new healthdata(); data.setsourcedevice(mydevice.getuuid()); data.putfloat(healthconstants.nutrition.calorie, 100); healthdataresolver.filter filter = healthdataresolver.filter.eq(healthconstants.nutrition.calorie, 10000); // build a request to update nutrition data which its calories is 10000 to 100 healthdataresolver.updaterequest request = new healthdataresolver.updaterequest.builder() .setdatatype(healthconstants.nutrition.health_data_type) .setfilter(filter) .sethealthdata(data) .build(); return request; } } since: 1.0.0 constructor summary constructors constructor and description builder() helps to construct a healthdataresolver.updaterequest object. method summary all methods instance methods concrete methods modifier and type method and description healthdataresolver.updaterequest build() builds a new healthdataresolver.updaterequest object. healthdataresolver.updaterequest.builder setdatatype(string type) sets a health data type to update. healthdataresolver.updaterequest.builder setfilter(healthdataresolver.filter filter) sets a filter for health data to update. healthdataresolver.updaterequest.builder sethealthdata(healthdata object) sets a health data object to update. healthdataresolver.updaterequest.builder setlocaltimerange(string timeproperty, string offsetproperty, long begin, long end) sets the local time range not to miss data from the query's result when there exist data with a different time_offset in the saved health data. healthdataresolver.updaterequest.builder setsourcedevices(list<string> uuidlist) sets a uuid list of source devices for health data to be updated. constructor detail builder public builder() helps to construct a healthdataresolver.updaterequest object. since: 1.0.0 method detail setdatatype public healthdataresolver.updaterequest.builder setdatatype(string type) sets a health data type to update. it has to be specified before calling build(). parameters: type - health_data_type of the data type returns: the object that applies the health data type since: 1.0.0 sethealthdata public healthdataresolver.updaterequest.builder sethealthdata(healthdata object) sets a health data object to update. it has to be specified before calling build(). parameters: object - the health data object to update. the source device of object should be valid. returns: the object that applies health data to update since: 1.0.0 setfilter public healthdataresolver.updaterequest.builder setfilter(healthdataresolver.filter filter) sets a filter for health data to update. parameters: filter - the filter object to update returns: the object that applies the filter since: 1.0.0 setsourcedevices public healthdataresolver.updaterequest.builder setsourcedevices(list<string> uuidlist) sets a uuid list of source devices for health data to be updated. parameters: uuidlist - the uuid list for source devices returns: the object that applies source devices since: 1.0.0 setlocaltimerange public healthdataresolver.updaterequest.builder setlocaltimerange(string timeproperty, string offsetproperty, long begin, long end) sets the local time range not to miss data from the query's result when there exist data with a different time_offset in the saved health data. the data that has a different time_offset with other data's time_offset can be saved when the daylight time is applied or the user moves to another region by like a travel. building a complete query to aggregate all data including the different time_offset is not easy. use this api to build an aggregate request as possible. parameters: timeproperty - the time property name that needs to add a filter offsetproperty - the time offset property begin - the beginning time with gmt+0 milliseconds. e.g. if you would like to update data from 00:00:00 on october 26th, 2021 in your region, set the value with 1635206400000. see sample codes. its minimum value is long.min_value. end - the end time with gmt+0 milliseconds. e.g. if you would like to update data until 00:00:00 on october 26th, 2021 in your region, set the value with 1635206400000. see sample codes. its maximum value is long.max_value. returns: the object that applies the local time range since: 1.5.0 build public healthdataresolver.updaterequest build() builds a new healthdataresolver.updaterequest object. check if following information is specified. data type health data to update returns: the healthdataresolver.updaterequest object throws: illegalstateexception - if data type, or health data object is not specified since: 1.0.0 see also: setdatatype(string), sethealthdata(healthdata)

      https://developer.samsung.com/health/android/data/api-reference/com/samsung/android/sdk/healthdata/HealthDataResolver.UpdateRequest.Builder.html
      1. Develop
      2. Health

      api

      HealthDataResolver.ReadRequest.Builder

      overview package class tree deprecated index com.samsung.android.sdk.healthdata class healthdataresolver.readrequest.builder java.lang.object com.samsung.android.sdk.healthdata.healthdataresolver.readrequest.builder enclosing interface: healthdataresolver.readrequest public static class healthdataresolver.readrequest.builder extends object this class is a builder to configure healthdataresolver.readrequest. private healthdataresolver.readrequest buildreadrequest(long starttime, long endtime) { healthdataresolver.filter filter = healthdataresolver.filter.greaterthan(healthconstants.nutrition.calorie, 200); healthdataresolver.readrequest request = new healthdataresolver.readrequest.builder() .setdatatype(healthconstants.nutrition.health_data_type) .setlocaltimerange(healthconstants.nutrition.start_time, healthconstants.nutrition.time_offset, starttime, endtime) .setfilter(filter) .build(); return request; } since: 1.0.0 constructor summary constructors constructor and description builder() helps to construct a healthdataresolver.readrequest object. method summary all methods instance methods concrete methods modifier and type method and description healthdataresolver.readrequest build() builds a new healthdataresolver.readrequest object. healthdataresolver.readrequest.builder setdatatype(string type) sets a health data type for the request to read. healthdataresolver.readrequest.builder setfilter(healthdataresolver.filter filter) sets a filter for the request to read. healthdataresolver.readrequest.builder setlocaltimerange(string timeproperty, string offsetproperty, long begin, long end) sets the local time range not to miss data from the query's result when there exist data with a different time_offset in the saved health data. healthdataresolver.readrequest.builder setpackagename(string packagename) sets the package name that provides health data to read. healthdataresolver.readrequest.builder setproperties(string[] properties) sets a property array for the health data result to read. healthdataresolver.readrequest.builder setpropertyalias(string property, string alias) sets an alias for the given property. healthdataresolver.readrequest.builder setresultcount(int offset, int count) sets the count range of result data with a given offset and count. healthdataresolver.readrequest.builder setsort(string property, healthdataresolver.sortorder sortorder) sets the sort order for a given property or alias. healthdataresolver.readrequest.builder setsourcedevices(list<string> uuidlist) sets a uuid list for source devices to read health data. healthdataresolver.readrequest.builder settimeafter(long time) sets the time range to retrieve result data which is inserted or updated to the health data store after the given time. constructor detail builder public builder() helps to construct a healthdataresolver.readrequest object. since: 1.0.0 method detail setdatatype public healthdataresolver.readrequest.builder setdatatype(string type) sets a health data type for the request to read. it has to be specified before calling build(). parameters: type - health_data_type of the data type returns: the object that applies the health data type since: 1.0.0 setfilter public healthdataresolver.readrequest.builder setfilter(healthdataresolver.filter filter) sets a filter for the request to read. parameters: filter - the filter object returns: the object that applies the filter since: 1.0.0 setsourcedevices public healthdataresolver.readrequest.builder setsourcedevices(list<string> uuidlist) sets a uuid list for source devices to read health data. parameters: uuidlist - the uuid list for source devices returns: the object that applies source devices since: 1.0.0 setproperties public healthdataresolver.readrequest.builder setproperties(string[] properties) sets a property array for the health data result to read. if it is not specified, the health data result shows all properties of the data type. parameters: properties - properties that want to gain in the result returns: the object that applies properties since: 1.0.0 setpropertyalias public healthdataresolver.readrequest.builder setpropertyalias(string property, string alias) sets an alias for the given property. parameters: property - the property to be shown with the alias alias - the alias for the property returns: the object that applies the alias for the property since: 1.0.0 setpackagename public healthdataresolver.readrequest.builder setpackagename(string packagename) sets the package name that provides health data to read. accessory data's package name samsung health collects the linked accessory's data also like galaxy watch. the accessory's data including galaxy watch is inserted to samsung health with the samsung health's package name, com.sec.android.app.shealth. if you want to read only the specific accessory's data, make a division the device id. parameters: packagename - the package name that provides health data returns: the object that applies the package name since: 1.0.0 setsort public healthdataresolver.readrequest.builder setsort(string property, healthdataresolver.sortorder sortorder) sets the sort order for a given property or alias. parameters: property - the property or alias to be shown with the sort order sortorder - the sort order returns: the object that applies the sort order since: 1.0.0 setresultcount public healthdataresolver.readrequest.builder setresultcount(int offset, int count) sets the count range of result data with a given offset and count. if this method is not called, all result will be obtained from the result. if you want to get only 10 data from the 3rd position in the result, set offset as 2 and count as 10. parameters: offset - the start position in the whole result, which equals to or is greater than 0 count - the limited count of result, which is greater than 0 returns: the object that applies the range of the result since: 1.0.0 settimeafter public healthdataresolver.readrequest.builder settimeafter(long time) sets the time range to retrieve result data which is inserted or updated to the health data store after the given time. it's different to set the time range based on the data's created or updated time to read data. if then, use: healthdataresolver.filter.greaterthan(java.lang.string, t) moreover it is useful to check the health data store's change after your app reads the health data store's data at the last time. if the data's source device is same with the current device, time means the inserted time that data is created on the current device. if the data's source device is different, time indicates the synchronized time that data on other devices is synchronized to samsung health of the current device. parameters: time - the time range to retrieve result data which is inserted or updated to the health data store after the specific time in milliseconds. its value is started from january, 1, 1970 00:00:00 utc. returns: the object that applies the range of the result since: 1.0.0 setlocaltimerange public healthdataresolver.readrequest.builder setlocaltimerange(string timeproperty, string offsetproperty, long begin, long end) sets the local time range not to miss data from the query's result when there exist data with a different time_offset in the saved health data. the data that has a different time_offset with other data's time_offset can be saved when the daylight time is applied or the user moves to another region by like a travel. building a complete query to read all data including the different time_offset is not easy. use this api to build a read request as possible. parameters: timeproperty - the time property name that needs to add a filter offsetproperty - the time offset property begin - the beginning time with gmt+0 milliseconds. e.g. if you would like to get data from 00:00:00 on october 26th, 2021 in your region, set the value with 1635206400000. see sample codes. its minimum value is long.min_value. end - the end time with gmt+0 milliseconds. e.g. if you would like to get data until 00:00:00 on october 26th, 2021 in your region, set the value with 1635206400000. see sample codes. its maximum value is long.max_value. returns: the object that applies the local time range since: 1.3.0 build public healthdataresolver.readrequest build() builds a new healthdataresolver.readrequest object. check if following information is specified. data type returns: the healthdataresolver.readrequest object throws: illegalstateexception - if enough information is not specified since: 1.0.0 see also: setdatatype(string)

      https://developer.samsung.com/health/android/data/api-reference/com/samsung/android/sdk/healthdata/HealthDataResolver.ReadRequest.Builder.html
      1. Learn
      2. Code Lab

      codelab

      Measure Blood Oxygen Level on Galaxy Watch

      measure blood oxygen level on galaxy watch objective create a health app for galaxy watches powered by wear os, utilizing the new samsung privileged health sdk to trigger and obtain blood oxygen level (spo2) measurement results. partnership request in this code lab, you will use a specially prepared mock library. it has limited functionality and uses dummy data instead of real-time data. to get real values, you will need the full version of the samsung privileged health sdk library, which is available to registered samsung partners. apply as a partner by checking out the partner app program to get exclusive access to the samsung privileged health sdk. overview samsung privileged health sdk provides means of accessing and tracking health information contained in the health data storage. its tracking service gives raw and processed sensor data such as accelerometer and body composition data sent by the samsung bioactive sensor. the latest bioactive sensor of galaxy watch runs powerful health sensors such as photoplethysmogram (ppg), electrocardiogram (ecg), bioelectrical impedance analysis (bia), sweat loss, and spo2. see samsung privileged health sdk descriptions for detailed information. set up your environment you will need the following: galaxy watch4 or newer android studio (latest version recommended) java se development kit (jdk) 11 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! measuring blood oxygen level sample code (110.13 kb) 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 debug over wi-fi turn off automatic wi-fi connect your galaxy watch to wi-fi go to settings > connection > wi-fi and make sure that wi-fi is enabled. from the list of available wi-fi networks, choose and connect to the same one as your pc. when successfully connected, tap a wi-fi network name, swipe down, and note the ip address. you will need this to connect your watch over adb from your pc. connect your galaxy watch to android studio in android studio, go to terminal and type: adb connect <ip address as mentioned in previous step> when prompted, tap always allow from this computer to allow debugging. upon successful connection, you will see the following message in android studio’s terminal: connected to <ip address of your watch> now, you can run the app directly on your watch. start your project after downloading the sample code containing the project files, in android studio click open to open existing project. locate the downloaded android project (basic) from the directory and click ok. check capabilities for the device to track data with the samsung privileged health sdk, it must support a given tracker type – blood oxygen level. to check this, get the list of available tracker types and verify that the tracker is on the list. in the connectionmanager.java file, navigate to the isspo2available() function, use a provided healthtrackingservice object to create a healthtrackercapability instance, send it to the checkavailabletrackers function, and assign its result to the availabletrackers list. gettrackingcapability() returns a healthtrackercapability instance in the healthtrackingservice object healthtrackingservicehealthtrackingservice initiates a connection to samsung's health tracking service and provides a healthtracker instance to track a healthtrackertype. public healthtrackercapability gettrackingcapability() provide a healthtrackercapability instance to get a supporting health tracker type list. /****************************************************************************************** * [practice 1] check capabilities to confirm spo2 availability * * ---------------------------------------------------------------------------------------- * * (hint) replace todo 1 with java code * get healthtrackercapability object from healthtrackingservice * send the object to checkavailabletrackers() ******************************************************************************************/ public boolean isspo2available(healthtrackingservice healthtrackingservice) { if (healthtrackingservice == null) return false; list<healthtrackertype> availabletrackers = null; //"todo 1" if (availabletrackers == null) return false; else return availabletrackers.contains(healthtrackertype.spo2); } check connection error resolution suppose a connection to the health tracking service attempt ends with an error. in that case, you can try to resolve it using the samsung privileged health sdk api. in the connectionmanager.java file, navigate to the processtrackerexception() function, and check if the provided healthtrackerexception object has a resolution. assign the result to hasresolution variable. hasresolution() function in the healthtrackerexception object checks if the api side can fix the error healthtrackerexceptionhealthtrackerexception contains error codes and checks the error's resolution. if there is a resolution, solving the error is available by calling resolve(activity). boolean hasresolution() checks whether the given error has a resolution. /******************************************************************************************* * [practice 2] resolve healthtrackerexception error * * ----------------------------------------------------------------------------------------- * * (hint) replace todo 2 with java code * call hasresolution() on healthtrackerexception object ******************************************************************************************/ public void processtrackerexception(healthtrackerexception e) { boolean hasresolution = false; //"todo 2" if (hasresolution) e.resolve(callingactivity); if (e.geterrorcode() == healthtrackerexception.old_platform_version || e.geterrorcode() == healthtrackerexception.package_not_installed) observerupdater.getobserverupdater().notifyconnectionobservers(r.string.novalidhealthplatform); else observerupdater.getobserverupdater().notifyconnectionobservers(r.string.connectionerror); log.e(tag, "could not connect to health tracking service: " + e.getmessage()); } initialize spo2 tracker before the measurement starts, initialize the spo2 tracker by obtaining the proper health tracker object. in the spo2listener.java file, navigate to the init() function. using the provided healthtrackingservice object, create an instance of the spo2 tracker and assign it to the spo2tracker object. gethealthtracker() with healthtrackertype.spo2 as an argument will create a healthtracker instance healthtrackingservicehealthtrackingservice initiates a connection to samsung's health tracking service and provides a healthtracker instance to track a healthtrackertype. healthtracker gethealthtracker(healthtrackertype healthtrackertype) provides a healthtracker instance for the given healthtrackertype. /******************************************************************************************* * [practice 3] initialize spo2 tracker * * ---------------------------------------------------------------------------------------- * * (hint) replace todo 3 with java code * initialize spo2tracker with proper samsung privileged health sdk functionality * call gethealthtracker() on healthtrackingservice object * use healthtrackertype.spo2 as an argument ******************************************************************************************/ void init(healthtrackingservice healthtrackingservice) { //"todo 3" } perform measurement for the client app to start obtaining the data through the sdk, it has to set a listener method on the healthtracker. the application setups the listener when the user taps on the measure button. each time there is new data, the listener callback receives it. after the measurement completes, the listener has to be disconnected. since, due to battery drain, on-demand measurement should not last more than approximately 30 seconds. the measurement will cancel if the final blood oxygen level value is not delivered in time. it’s also worth noting that the sensor needs a few seconds to warm up and provide correct values, adding to the overall measurement time. the blood oxygen level values come in the ondatareceived callback of trackereventlistener. see below example of the code, in the spo2listener.java file, reading the value: private final healthtracker.trackereventlistener spo2listener = new healthtracker.trackereventlistener() { @override public void ondatareceived(@nonnull list<datapoint> list) { for (datapoint data : list) { updatespo2(data); } } }; private void updatespo2(datapoint data) { int status = data.getvalue(valuekey.spo2set.status); int spo2value = 0; if (status == measurement_completed) spo2value = data.getvalue(valuekey.spo2set.spo2); observerupdater.getobserverupdater().notifytrackerobservers(status, spo2value); } 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. see instructions below on how to run the unit tests: right click on com.samsung.sdc22.health.basic (test) and execute run 'tests in 'com.samsung.sdc22.health.basic'' command. if you completed all the tasks correctly, you will see all the unit tests passed successfully. run the app after building the apk, you can run the application on a connected device to measure your blood oxygen level. right after the app is started, it will request user permission. allow the app to receive data from the body sensors. afterwards, it will show the application's main screen. to get the blood oxygen level value, tap on the measure button. to stop the measurement, tap on the stop button. you're done! congratulations! you have successfully achieved the goal of this code lab. now, you can create a health app that measures blood oxygen level by yourself! if you're having trouble, you may download this file: measuring blood oxygen level complete code (109.86 kb) to learn more about samsung health, visit: developer.samsung.com/health

      https://developer.samsung.com/codelab/health/blood-oxygen.html
      1. Develop
      2. Health

      doc

      Data Viewer

      data viewer dataviewer is a very useful tool to check saved data in samsung health. you can find it in the downloaded sdk's /data/tools folder. prerequisites install dataviewer and open it. activating the developer mode is not required from samsung health 6.11. dataviewer provides the sdk's supported data type list and some useful menus. the following figure shows its main screen and corresponding menus. checking saved data you can check the saved data in samsung health by selecting one of the data types in the figure below. each data type can be accessed after the data permission agreement. whenever you select a data type on the mains screen’s data list, the permission ui displays. then saved data in samsung health are listed up with its respective timestamp. by selecting each data type, you can see detailed data info including its measured time or a source app package name. checking the saved data with dataviewer is the exact way to test your app when it writes measured data to samsung health. the inserted data cannot be shown on samsung health caused by its ui policy or wrong setting of "start_time" and "time_offset". make sure to set the following information well especially: measured data value and its unit "start_time" that indicates the measurement time and "time_offset"

      https://developer.samsung.com/health/android/data/guide/data-viewer.html
      1. Develop
      2. Health

      api

      HealthDataResolver.DeleteRequest.Builder

      overview package class tree deprecated index com.samsung.android.sdk.healthdata class healthdataresolver.deleterequest.builder java.lang.object com.samsung.android.sdk.healthdata.healthdataresolver.deleterequest.builder enclosing interface: healthdataresolver.deleterequest public static class healthdataresolver.deleterequest.builder extends object this class is a builder to configure healthdataresolver.deleterequest. only your app's created health data can be deleted. public class healthdataresolverexample { private healthdataresolver.deleterequest builddeleterequest() { healthdataresolver.filter filter = healthdataresolver.filter.lessthan(healthconstants.nutrition.calories, 10); healthdataresolver.deleterequest request = new healthdataresolver.deleterequest.builder() .setdatatype(healthconstants.nutrition.health_data_type) .setfilter(filter) .build(); return request; } } since: 1.0.0 constructor summary constructors constructor and description builder() helps to construct a healthdataresolver.deleterequest object. method summary all methods instance methods concrete methods modifier and type method and description healthdataresolver.deleterequest build() builds a new healthdataresolver.deleterequest object. healthdataresolver.deleterequest.builder setdatatype(string type) sets a health data type to delete. healthdataresolver.deleterequest.builder setfilter(healthdataresolver.filter filter) sets a filter for health data to be deleted. healthdataresolver.deleterequest.builder setlocaltimerange(string timeproperty, string offsetproperty, long begin, long end) sets the local time range not to miss data from the query's result when there exist data with a different time_offset in the saved health data. healthdataresolver.deleterequest.builder setsourcedevices(list<string> uuidlist) sets a uuid list of source devices for health data to be deleted. constructor detail builder public builder() helps to construct a healthdataresolver.deleterequest object. since: 1.0.0 method detail setdatatype public healthdataresolver.deleterequest.builder setdatatype(string type) sets a health data type to delete. it has to be specified before calling build(). parameters: type - health_data_type of the data type returns: the object that applies health data to delete since: 1.0.0 setfilter public healthdataresolver.deleterequest.builder setfilter(healthdataresolver.filter filter) sets a filter for health data to be deleted. it has to be specified before calling build(). parameters: filter - the filter object to delete returns: the object that applies the filter since: 1.0.0 setsourcedevices public healthdataresolver.deleterequest.builder setsourcedevices(list<string> uuidlist) sets a uuid list of source devices for health data to be deleted. parameters: uuidlist - the uuid list for source devices returns: the object that applies source devices since: 1.0.0 setlocaltimerange public healthdataresolver.deleterequest.builder setlocaltimerange(string timeproperty, string offsetproperty, long begin, long end) sets the local time range not to miss data from the query's result when there exist data with a different time_offset in the saved health data. the data that has a different time_offset with other data's time_offset can be saved when the daylight time is applied or the user moves to another region by like a travel. building a complete query to aggregate all data including the different time_offset is not easy. use this api to build an aggregate request as possible. parameters: timeproperty - the time property name that needs to add a filter offsetproperty - the time offset property begin - the beginning time with gmt+0 milliseconds. e.g. if you would like to delete data from 00:00:00 on october 26th, 2021 in your region, set the value with 1635206400000. see sample codes. its minimum value is long.min_value. end - the end time with gmt+0 milliseconds. e.g. if you would like to delete data until 00:00:00 on october 26th, 2021 in your region, set the value with 1635206400000. see sample codes. its maximum value is long.max_value. returns: the object that applies the local time range since: 1.5.0 build public healthdataresolver.deleterequest build() builds a new healthdataresolver.deleterequest object. check if the data type is defined with setdatatype(string). returns: the healthdataresolver.deleterequest object throws: illegalstateexception - if no data type is specified since: 1.0.0 see also: setdatatype(string)

      https://developer.samsung.com/health/android/data/api-reference/com/samsung/android/sdk/healthdata/HealthDataResolver.DeleteRequest.Builder.html
      1. Learn
      2. Code Lab

      codelab

      Measure Blood Oxygen Level and Heart Rate on Galaxy Watch

      measure blood oxygen level and heart rate on galaxy watch objective create a health app for galaxy watches powered by wear os, utilizing the new samsung privileged health sdk to trigger and obtain results of simultaneous blood oxygen level (spo2) and heart rate measurements. partnership request in this code lab, you will use a specially prepared mock library. it has limited functionality and uses dummy data instead of real-time data. to get real values, you will need the full version of the samsung privileged health sdk library, which is available to samsung partners. apply as a partner by checking out the partner app program to get exclusive access to the samsung privileged health sdk. overview samsung privileged health sdk provides means of accessing and tracking health information contained in the health data storage. its tracking service gives raw and processed sensor data such as accelerometer and body composition data sent by the samsung bioactive sensor. the latest bioactive sensor of galaxy watch runs powerful health sensors such as photoplethysmogram (ppg), electrocardiogram (ecg), bioelectrical impedance analysis (bia), sweat loss, and spo2. see samsung privileged health sdk descriptions for detailed information. set up your environment you will need the following: galaxy watch4 or newer android studio (latest version recommended) java se development kit (jdk) 11 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! measuring blood oxygen level and heart rate sample code (128.16 kb) 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 debug over wi-fi turn off automatic wi-fi connect your galaxy watch to wi-fi go to settings > connection > wi-fi and make sure that wi-fi is enabled. from the list of available wi-fi networks, choose and connect to the same one as your pc. when successfully connected, tap a wi-fi network name, swipe down, and note the ip address. you will need this to connect your watch over adb from your pc. connect your galaxy watch to android studio in android studio, go to terminal and type: adb connect <ip address as mentioned in previous step> when prompted, tap always allow from this computer to allow debugging. upon successful connection, you will see the following message in android studio’s terminal: connected to <ip address of your watch> now, you can run the app directly on your watch. start your project after downloading the sample code containing the project files, in android studio click open to open existing project. locate the downloaded android project (advanced) from the directory and click ok. establish service connection and check capabilities for the device to track data with the samsung privileged health sdk, it must connect to the service by healthtrackingservice api. after establishing a connection, verify if the required tracker type is available. to check this, get the list of available tracker types and verify that the tracker is on the list. in this code lab, you will utilize blood oxygen level and heart rate trackers. the healthtrackingservice api usage is in the table below. healthtrackingservicehealthtrackingservice initiates a connection to samsung's health tracking service and provides a healthtracker instance to track a healthtrackertype. public void connectservice() establish a connection with samsung's health tracking service. public void disconnectservice() release a connection for samsung's health tracking service. public healthtrackercapability gettrackingcapability() provide a healthtrackercapability instance to get a supporting health tracker type list. initialize multiple trackers before the measurement starts, initialize the spo2 tracker by obtaining the proper health tracker object. in the connectionmanager.java file, navigate to initspo2(), create an oxygen saturation healthtracker instance, and pass it to the spo2listener instance. get the healthtracker object using the healthtrackingservice api. use the healthtrackertype.spo2 type as parameter. healthtrackingservicehealthtrackingservice initiates a connection to samsung's health tracking service and provides a healthtracker instance to track a healthtrackertype. public healthtracker gethealthtracker(healthtrackertype healthtrackertype) provide a healthtracker instance for the given healthtrackertype. pass the healthtracker object to the spo2listener instance object. spo2listener public void sethealthtracker(healthtracker tracker) set healthtracker instance for the given tracker. /******************************************************************************************* * [practice 1] create blood oxygen level health tracker object * - get health tracker object * - pass it to spo2listener ------------------------------------------------------------------------------------------- * - (hint) replace todo 1 with parts of code * (1) get healthtracker object using healthtrackingservice.gethealthtracker() * use healthtrackertype.spo2 type as parameter * (2) pass it to spo2listener using sethealthtracker function ******************************************************************************************/ public void initspo2(spo2listener spo2listener) { //"todo 1 (1)" //"todo 1 (2)" sethandlerforbaselistener(spo2listener); } next, in the connectionmanager.java file, in the initheartrate() function, create a heart rate healthtracker instance, and pass it to the heartratelistener instance. get the healthtracker object using the healthtrackingservice api. use the healthtrackertype.heart_rate type as parameter. pass the healthtracker object to the heartratelistener instance object. heartratelistener public void sethealthtracker(healthtracker tracker) set healthtracker instance for the given tracker. /******************************************************************************************* * [practice 2] create heart rate health tracker object * - get health tracker object * - pass it to heartratelistener ------------------------------------------------------------------------------------------- * - (hint) replace todo 2 with parts of code * (1) get healthtracker object using healthtrackingservice.gethealthtracker() * use healthtrackertype.heart_rate type as parameter * (2) pass it to heartratelistener using sethealthtracker function ******************************************************************************************/ public void initheartrate(heartratelistener heartratelistener) { //"todo 2 (1)" //"todo 2 (2)" sethandlerforbaselistener(heartratelistener); } start and stop trackers for the client app to start obtaining the data through the sdk, set a listener method on healthtracker. this method will be called every time there is new data. after the measurement completes, the listener has to be disconnected. to start measurement in the baselistener.java file, navigate to starttracker() function, and set trackereventlistener as listener healthtracker object. set an event listener on healthtracker object using healthtracking api. use the healthtracker.trackereventlistener object instance as parameter. healthtrackerhealthtracker enables an application to set an event listener and get tracking data for a specific healthtrackertype. public void seteventlistener(healthtracker.trackereventlistener listener) set an event listener to this healthtracker instance. /******************************************************************************************* * [practice 3] start health tracker by setting event listener * - set event listener on health tracker ------------------------------------------------------------------------------------------- * - (hint) replace todo 3 with parts of code * set event listener on healthtracker object using healthtracker.seteventlistener() * use trackereventlistener object as parameter ******************************************************************************************/ public void starttracker() { log.i(app_tag, "starttracker called "); log.d(app_tag, "healthtracker: " + healthtracker.tostring()); log.d(app_tag, "trackereventlistener: " + trackereventlistener.tostring()); if (!ishandlerrunning) { handler.post(() -> { //"todo 3" sethandlerrunning(true); }); } } to stop measurement, unset the trackereventlistener from the healthtracker object in the stoptracker() function. unset the event listener on healthtracker object using healthtracking api. healthtrackerhealthtracker enables an application to set an event listener and get tracking data for a specific healthtrackertype. public void unseteventlistener() stop the registered event listener to this healthtracker instance. /******************************************************************************************* * [practice 4] stop health tracker by removing event listener * - unset event listener on health tracker ------------------------------------------------------------------------------------------- * - (hint) replace todo 4 with parts of code * unset event listener on healthtracker object using healthtracker.unseteventlistener() ******************************************************************************************/ public void stoptracker() { log.i(app_tag, "stoptracker called "); log.d(app_tag, "healthtracker: " + healthtracker.tostring()); log.d(app_tag, "trackereventlistener: " + trackereventlistener.tostring()); if (ishandlerrunning) { //"todo 4" sethandlerrunning(false); handler.removecallbacksandmessages(null); } } process obtained and batching data the response from the platform will be asynchronous with the results you want to obtain. follow the steps below to get blood oxygen level and heart rate data. in the spo2listener.java file, navigate to updatespo2() function, and read spo2 data from datapoint: get the oxygen saturation status using the datapoint api (key: valuekey.spo2set.status). get the oxygen saturation value using the datapoint api (key: valuekey.spo2set.spo2). datapointdatapoint provides a map of valuekey and value with a timestamp. public <t>t getvalue(valuekey<t> type) get data value for the given key. /******************************************************************************************* * [practice 5] read values from datapoint object * - get blood oxygen level status * - get blood oxygen level value ------------------------------------------------------------------------------------------- * - (hint) replace todo 5 with parts of code * (1) remove spo2status.calculating and * set status from 'datapoint' object using datapoint.getvalue(valuekey.spo2set.status) * (2) set spo2value from 'datapoint' object using datapoint.getvalue(valuekey.spo2set.spo2) * if status is 'spo2status.measurement_completed' ******************************************************************************************/ public void updatespo2(datapoint datapoint) { int status = spo2status.calculating; //"todo 5 (1)" int spo2value = 0; //"todo 5 (2)" trackerdatanotifier.getinstance().notifyspo2trackerobservers(status, spo2value); log.d(app_tag, datapoint.tostring()); } in the heartratelistener.java file, navigate to readvaluesfromdatapoint() function, and read the heart rate data from datapoint: get the heart rate status using the datapoint api (key: valuekey.heartrateset. status). get the heart rate value using the datapoint api (key: valuekey.heartrateset.heart_rate). get the heart rate inter-beat interval (ibi) value using the datapoint api (key: valuekey.heartrateset. heart_rate_ibi). calculate the ibi quality using the first bit from the heart rate ibi value. calculate the ibi value using the remaining 15 bits from the heart rate ibi value. /******************************************************************************************* * [practice 6] read values from datapoint object * - get heart rate status * - get heart rate value * - get heart rate ibi value * - check retrieved heart rate’s ibi and ibi quality values ------------------------------------------------------------------------------------------- * - (hint) replace todo 6 with parts of code * (1) set hrdata.status from 'datapoint' object using datapoint.getvalue(valuekey.heartrateset.status) * (2) set hrdata.hr from 'datapoint' object using datapoint.getvalue(valuekey.heartrateset.heart_rate) * (3) set local variable 'final int hribi' using datapoint.getvalue(valuekey.heartrateset.heart_rate_ibi) * (4) set hrdata.qibi with the first of 16 bits of 'hribi' value * (use heartratedata.ibi_quality_shift 15 bits shift and heartratedata.ibi_mask 1 bit mask) * (5) set hrdata.ibi with the rest of the 15 bits of 'hribi' value * (use heartratedata.ibi_quality_mask 15 bit mask) ******************************************************************************************/ public void readvaluesfromdatapoint(datapoint datapoint) { heartratedata hrdata = new heartratedata(); //"todo 6 (1)" //"todo 6 (2)" //"todo 6 (3)" //"todo 6 (4)" //"todo 6 (5)" trackerdatanotifier.getinstance().notifyheartratetrackerobservers(hrdata); log.d(app_tag, datapoint.tostring()); } 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. see instructions below on how to run the unit tests: right click on com.samsung.sdc22.health.advanced (test) and execute run 'tests in 'com.samsung.sdc22.health.advanced'' command. if you completed all the tasks correctly, you will see all the unit tests passed successfully. run the app after building the apk, you can run the application on a connected device to see blood oxygen level and heart rate values. right after the app is started, it will request user permission. allow the app to receive data from the body sensors. afterwards, it will show the application's main screen and automatically display the heart rate. to get the blood oxygen level (spo2) value, tap on the measure button. to stop the measurement, tap on the stop button. tap on the details label to see more heart rate data. you're done! congratulations! you have successfully achieved the goal of this code lab. now, you can create a health app that measures blood oxygen level and heart rate by yourself! if you're having trouble, you may download this file: measuring blood oxygen level and heart rate complete code (120.06 kb) to learn more about samsung health, visit: developer.samsung.com/health

      https://developer.samsung.com/codelab/health/blood-oxygen-heart-rate.html
      1. Develop
      2. Health

      api

      HealthConstants.Common

      overview package class tree deprecated index com.samsung.android.sdk.healthdata interface healthconstants.common all known subinterfaces: healthconstants.albumin, healthconstants.alp, healthconstants.alt, healthconstants.ambienttemperature, healthconstants.amylase, healthconstants.ast, healthconstants.bloodglucose, healthconstants.bloodpressure, healthconstants.bodyfat, healthconstants.bodymuscle, healthconstants.bodytemperature, healthconstants.bun, healthconstants.caffeineintake, healthconstants.cpk, healthconstants.creatinine, healthconstants.directbilirubin, healthconstants.discretemeasurement, healthconstants.electrocardiogram, healthconstants.exercise, healthconstants.fev1, healthconstants.floorsclimbed, healthconstants.foodinfo, healthconstants.foodintake, healthconstants.fvc, healthconstants.ggt, healthconstants.globulin, healthconstants.hba1c, healthconstants.hdlc, healthconstants.healthdocument, healthconstants.heartrate, healthconstants.height, healthconstants.hipcircumference, healthconstants.homocysteine, healthconstants.ldh, healthconstants.ldlc, healthconstants.nutrition, healthconstants.oxygensaturation, healthconstants.sessionmeasurement, healthconstants.sleep, healthconstants.sleepstage, healthconstants.stepcount, healthconstants.stepdailytrend, healthconstants.totalbilirubin, healthconstants.totalcholesterol, healthconstants.totalprotein, healthconstants.triglyceride, healthconstants.uph, healthconstants.usg, healthconstants.uvexposure, healthconstants.waistcircumference, healthconstants.waterintake, healthconstants.weight enclosing class: healthconstants public static interface healthconstants.common this interface contains the common constants for health data such as the data's unique id, the application package name which provides data, and the data's source device information. since: 1.0.0 field summary fields modifier and type field and description static string create_time utc milliseconds when a data is created in the health data store. static string custom custom info which is formatted with json and compressed data. static string device_uuid device identifier of the source device which provides a health data. static string package_name package name which provides a data. static string update_time utc milliseconds when a data is updated. static string uuid unique id for each health data. field detail uuid static final string uuid unique id for each health data. you don't need to set its value because it is assigned by the system when a new data is inserted. assigned by the system type: string value length: 10 ~ 36 since: 1.0.0 see also: constant field values create_time static final string create_time utc milliseconds when a data is created in the health data store. you don't need to set its value because it is assigned by the system when a new data is inserted. it is different with start_time that indicates the start time for measurement. assigned by the system type: long value range: 0 and above since: 1.0.0 see also: constant field values update_time static final string update_time utc milliseconds when a data is updated. you don't need to set its value. when a new data is inserted, it is assigned as the same value with create_time by the system. then it is replaced to the updated time by the system if existing health data is updated. assigned by the system type: long value range: 0 and above since: 1.0.0 see also: constant field values package_name static final string package_name package name which provides a data. you don't need to set its value because it is assigned by the system when a new data is inserted. assigned by the system type: string value length: 0 ~ 64 since: 1.0.0 see also: constant field values device_uuid static final string device_uuid device identifier of the source device which provides a health data. mandatory type: string value length: 10 ~ 36 set the device id with healthdata.setsourcedevice(string) to query health data. since: 1.0.0 see also: constant field values custom static final string custom custom info which is formatted with json and compressed data. it is used to customize the predefined data type. otherwise, custom info can be retrieved from the saved data if you know the custom property's json format already. optional type: byte[] compressed json conversion can be: converting data to compressed json getting data from compressed json since: 1.3.0 see also: healthdatautil, constant field values

      https://developer.samsung.com/health/android/data/api-reference/com/samsung/android/sdk/healthdata/HealthConstants.Common.html
      No Search Results
      No Search results. Try using another keyword.
      • <<
      • <
      • 1
      • 2
      • 3
      • 4
      • 5
      • 6
      • 7
      • 8
      • 9
      • 10
      • >
      • >>
      Samsung Developers
      Samsung Developers
      Quick Link
      • Android USB Driver
      • Code Lab
      • Galaxy Emulator Skin
      • Foldables and Large Screens
      • One UI Beta
      • Remote Test Lab
      • Samsung Developers Podcast
      Family Site
      • Bixby
      • Knox
      • Samsung Pay
      • SmartThings
      • Tizen
      • Samsung Research
      • Samsung Open Source
      • Samsung Dev Spain
      • Samsung Dev Brazil
      Legal
      • Terms
      • Privacy
      • Open Source License
      • Cookie Policy
      Social Communications
      • Facebook
      • Instagram
      • Twitter
      • YouTube
      • Buzzsprout
      • Rss
      • Linkedin
      • System Status
      • Site Map
      • System Status
      • Site Map
      • facebook
      • instagram
      • twitter
      • youtube
      • buzzsprout
      • rss
      • linkedin

      Copyright © 2023 SAMSUNG. All rights reserved.