• 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
      • Galaxy Watch for Tizen
      • Watch Face Studio
      • One UI Watch for Tizen
      • Galaxy Watch Studio Converter
      • Samsung IAP for Galaxy Watch (Tizen)
    • 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
    • SDC23
    • 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
      • DOCS (100)
      • SDK
      • API REFERENCE
      • CODE LAB
      • BLOG
      • NEWS/EVENTS
      • OTHERS
        api reference code lab blog news/events
      1. Develop
      2. Health

      api

      HealthDataResolver

      overview package class tree deprecated index com.samsung.android.sdk.healthdata class healthdataresolver java.lang.object com.samsung.android.sdk.healthdata.healthdataresolver public class healthdataresolver extends object this class is able to access health data to insert, read, update, and delete with the specified filter and some aggregate functions. data management health data can be accessed with following interfaces mainly. healthdataresolver.insertrequest healthdataresolver.readrequest healthdataresolver.updaterequest healthdataresolver.deleterequest healthdataresolver.aggregaterequest filter handling a part of data is a common use case rather than accessing whole data for the health data type. the health data framework provides a filter to specify the precise scope for health data and is able to access required data only. healthdataresolver.filter asynchronous data request the asynchronous request is used normally for operations that take a time such as reading data with conditions. if you need to request asynchronously, set the result listener with healthresultholder.setresultlistener(healthresultholder.resultlistener). the following example shows how to make an asynchronous request. public class healthdataresolverexample { // the state of connection healthdatastore mstore; public static final string app_tag = "myapp"; public void readglucoseasynchronously(long starttime, long endtime) { healthdataresolver resolver = new healthdataresolver(mstore, null); healthdataresolver.readrequest request = new healthdataresolver.readrequest.builder() .setdatatype(healthconstants.bloodglucose.health_data_type) .setlocaltimerange(healthconstants.bloodglucose.start_time, healthconstants.bloodglucose.time_offset, starttime, endtime) .build(); try { resolver.read(request).setresultlistener(mrdresult); } catch (exception e) { log.d(app_tag, "reading health data fails."); } } private final healthresultholder.resultlistener<healthdataresolver.readresult> mrdresult = new healthresultholder.resultlistener<healthdataresolver.readresult>(){ @override public void onresult(healthdataresolver.readresult result) { try { iterator<healthdata> iterator = result.iterator(); if (iterator.hasnext()) { healthdata data = iterator.next(); float glucosevalue = data.getfloat(healthconstants.bloodglucose.glucose); } finally { result.close(); } }; } synchronous datarequest though asynchronous data request is used commonly, there is a way to get the query result synchronously with healthresultholder.await(). note, not to make the synchronous request on the ui thread. healthresultholder.await() throws an exception if it is called on the main thread. it can hang your application caused by taking a time to handle the synchronous query. the following example shows how to make a synchronous request. public class healthdataresolverexample { // the state of connection healthdatastore mstore; public static final string app_tag = "myapp"; public void readglucosesynchronously(long starttime, long endtime) { healthdataresolver resolver = new healthdataresolver(mstore, null); healthdataresolver.readrequest request = new healthdataresolver.readrequest.builder() .setdatatype(healthconstants.bloodglucose.health_data_type) .setlocaltimerange(healthconstants.bloodglucose.start_time, healthconstants.bloodglucose.time_offset, starttime, endtime) .build(); try { // checks the result immediately healthdataresolver.readresult rdresult = resolver.read(request).await(); try { iterator<healthdata> iterator = rdresult.iterator(); if (iterator.hasnext()) { healthdata data = iterator.next(); float glucosevalue = data.getfloat(healthconstants.bloodglucose.glucose); } finally { rdresult.close(); } } catch (exception e) { log.d(app_tag, "reading health data fails."); } } } acquiring data permission getting data permission is required after connection to the health data store to synchronize health data with samsung health. samsung health sdk for android provides the data permission ui to get the user's consent. the user can agree to share health data with the application through the permission ui and the application can get required data permission check healthpermissionmanager to use the permission ui. if you try to read or write health data without permission, the sdk gives securityexception. acquiring instant data permission gaining the healthconstants.healthdocument type's permission is different with other data types. it is available by acquiring the instant permission. instant permission is created for one-time data access. it is proper to handle very sensitive health data. the data type needs the instant permission is healthconstants.healthdocument. an app needs the instant permission whenever it accesses health document data. healthdataresolver.insertwithpermission() healthdataresolver.readwithpermission() healthdataresolver.deletewithpermission() if you call healthdataresolver.readwithpermission(), its permission pop-up is shown. the user can select one or more health documents in the list and read the selected document. class relationship of healthdataresolver see a relationship of healthdataresolver with other classes. since: 1.0.0 nested class summary nested classes modifier and type class and description static interface healthdataresolver.aggregaterequest this interface represents an aggregate request with aggregate functions and the specified time unit to group result values. static class healthdataresolver.aggregateresult this class represents the result of healthdataresolver.aggregaterequest. static interface healthdataresolver.deleterequest this interface is able to make a request to delete health data for the specific health data type. static class healthdataresolver.filter this class creates a filter to make the request range clear. static interface healthdataresolver.insertrequest this interface is able to make a request to insert health data for the specific health data type. static interface healthdataresolver.readrequest this interface is able to make a request to read health data for the specific health data type. static class healthdataresolver.readresult this class represents the result for healthdataresolver.readrequest. static class healthdataresolver.sortorder this enum defines sort orders. static interface healthdataresolver.updaterequest this interface is able to make a request to update health data for the specific health data type. constructor summary constructors constructor and description healthdataresolver(healthdatastore store, handler handler) creates a healthdataresolver instance. method summary all methods instance methods concrete methods modifier and type method and description healthresultholder<healthdataresolver.aggregateresult> aggregate(healthdataresolver.aggregaterequest request) aggregates health data with the given request. healthresultholder<healthresultholder.baseresult> delete(healthdataresolver.deleterequest request) deletes health data with the given request. healthresultholder<healthresultholder.baseresult> deletewithpermission(healthdataresolver.deleterequest request, activity activity) deletes health data required instant permission with the given request. healthresultholder<healthresultholder.baseresult> insert(healthdataresolver.insertrequest request) inserts new health data with the given request. healthresultholder<healthresultholder.baseresult> insertwithpermission(healthdataresolver.insertrequest request, activity activity) inserts new health data required instant permission with the given request. healthresultholder<healthdataresolver.readresult> read(healthdataresolver.readrequest request) reads health data with the given request. healthresultholder<healthdataresolver.readresult> readwithpermission(healthdataresolver.readrequest request, activity activity) reads health data required instant permission with the given request. healthresultholder<healthresultholder.baseresult> update(healthdataresolver.updaterequest request) updates health data with the given request. constructor detail healthdataresolver public healthdataresolver(healthdatastore store, handler handler) creates a healthdataresolver instance. parameters: store - the health data store for connection handler - the handler for the proceeding thread. if it's null, the looper of the current thread will be used. since: 1.0.0 method detail insert public healthresultholder<healthresultholder.baseresult> insert(healthdataresolver.insertrequest request) inserts new health data with the given request. it can be implemented asynchronously or synchronously. check this request's result in healthresultholder.baseresult.getstatus(). parameters: request - the request to insert new health data returns: the healthresultholder instance which resolves to the healthresultholder.baseresult for inserted health data throws: illegalargumentexception - if the request contains invalid instance type or null. securityexception - if there is no permission to write for given health data illegalstateexception - if the instance of health data store is invalid or a remote-invocation error occurs on the connection since: 1.0.0 insertwithpermission public healthresultholder<healthresultholder.baseresult> insertwithpermission(healthdataresolver.insertrequest request, activity activity) inserts new health data required instant permission with the given request. calling this method, a file chooser is shown to acquire the user consent. after the user chooses all or some of files, those are finally inserted. it can be implemented asynchronously or synchronously. check this request's result in healthresultholder.baseresult.getstatus(). parameters: request - the request to insert new health data activity - the activity that pop up the permission ui returns: the healthresultholder instance which resolves to the healthresultholder.baseresult for inserted health data throws: illegalargumentexception - if the request contains invalid instance typeor null. illegalstateexception - if the instance of health data store is invalid or a remote-invocation error occurs on the connection since: 1.3.0 update public healthresultholder<healthresultholder.baseresult> update(healthdataresolver.updaterequest request) updates health data with the given request. it can be implemented asynchronously or synchronously. check this request's result through healthresultholder.baseresult.getstatus(). parameters: request - the request to update health data returns: the healthresultholder instance which resolves to the healthresultholder.baseresult for updated health data throws: illegalargumentexception - if the request contains invalid instance typeor null. securityexception - if there is no permission to write for given health data illegalstateexception - if the instance of health data store is invalid or a remote-invocation error occurs on the connection since: 1.0.0 delete public healthresultholder<healthresultholder.baseresult> delete(healthdataresolver.deleterequest request) deletes health data with the given request. it can be implemented asynchronously or synchronously. parameters: request - the request to delete health data returns: the healthresultholder instance which resolves to the healthresultholder.baseresult for deleted health data throws: illegalargumentexception - if the request contains invalid instance type or null securityexception - if there is no permission to write for given health data illegalstateexception - if the instance of health data store is invalid or a remote-invocation error occurs on the connection since: 1.0.0 deletewithpermission public healthresultholder<healthresultholder.baseresult> deletewithpermission(healthdataresolver.deleterequest request, activity activity) deletes health data required instant permission with the given request. calling this method, a file chooser is shown to acquire the user consent. after the user chooses all or some of files, those are finally deleted. it can be implemented asynchronously or synchronously. parameters: request - the request to delete health data activity - the activity that pop up the permission ui returns: the healthresultholder instance which resolves to the healthresultholder.baseresult for deleted health data throws: illegalargumentexception - if the request contains invalid instance type or null illegalstateexception - if the instance of health data store is invalid or a remote-invocation error occurs on the connection since: 1.3.0 read public healthresultholder<healthdataresolver.readresult> read(healthdataresolver.readrequest request) reads health data with the given request. it can be implemented asynchronously or synchronously. parameters: request - the request to read health data returns: the healthresultholder instance which resolves to the healthdataresolver.readresult for health data to read throws: illegalargumentexception - if the request contains invalid instance type or null securityexception - if there is no permission to read for given health data illegalstateexception - if the instance of health data store is invalid or a remote-invocation error occurs on the connection since: 1.0.0 readwithpermission public healthresultholder<healthdataresolver.readresult> readwithpermission(healthdataresolver.readrequest request, activity activity) reads health data required instant permission with the given request. calling this method, a file chooser is shown to acquire the user consent. after the user chooses all or some of files, those are finally read. it can be implemented asynchronously or synchronously. parameters: request - the request to read health data activity - the activity that pop up the permission ui returns: the healthresultholder instance which resolves to the healthdataresolver.readresult for health data to read throws: illegalargumentexception - if the request contains invalid instance type or null illegalstateexception - if the instance of health data store is invalid or a remote-invocation error occurs on the connection since: 1.3.0 aggregate public healthresultholder<healthdataresolver.aggregateresult> aggregate(healthdataresolver.aggregaterequest request) aggregates health data with the given request. it can be implemented asynchronously or synchronously. parameters: request - the aggregate request for health data returns: the healthdataresolver.aggregateresult instance which resolves to the healthdataresolver.readresult for the requested aggregate throws: illegalargumentexception - if the request contains invalid instance type or null securityexception - if there is no permission to read for given health data illegalstateexception - if the instance of health data store is invalid or a remote-invocation error occurs on the connection since: 1.0.0

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

      doc

      Process

      development process after checking prerequisites and downloading the sdk, you're ready to create your application through the following steps. partnership with samsung health partner app program is an exclusive service for samsung health that allows users to discover engaging health and fitness applications. an application that uses the sdk will work properly with samsung health after the partner app approval. partnership with samsung health team is requires before using the sdk. note : we are currently going through an update to better support our partners. for that reason, we will not be accepting any applications for the partner apps program at this time. connection design guide it provides the user interface guidelines for its partner apps to unify the entry point for the connection to samsung health and related interfaces. read connection design guide and apply them to your application. an application that doesn't follow the guidelines can be rejected for the partner application. data synchronization design the partner app of samsung health needs to synchronize the health data. the sdk enables your app to read samsung health's data and write your app's data to samsung health. see data types for the available data types. main data types that represent your application should be contained for data integration. the synchronized data between your application and samsung health needs to give a natural flow to the users. e.g. in case of the nutrition app, the user thinks nutrition data would be shared with samsung health without doubt. creating an application create an app project and develop your app. see hello health data for a quick start. testing your application the app that uses the sdk works with samsung health after the partner app approval. it needs to be tested fully before applying for the partner app. the sdk provides the following environments. samsung health‘s developer mode sdk's dataviewer checklist for samsung health’s partner app note : samsung health sdk for android doesn't support the emulator test. android 6.0 marshmallow (api level 23) device or above is required to test your app. samsung health's developer mode you can use developer mode to test or debug your app. dataviewer dataviewer reads saved health data in samsung health for each data. see data viewer for more information. checklist for samsung health's partner app samsung health sdk for android provides a checklist that includes basic test items for the app test. download the checklist and check your app before applying for partner app on the developer site. it helps you save time on the samsung health's registration process. publishing your application if your app is approved as a samsung health's partner, package and publish your app on the application market such as google play.

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

      api

      HealthData

      overview package class tree deprecated index com.samsung.android.sdk.healthdata class healthdata java.lang.object com.samsung.android.sdk.healthdata.healthdata all implemented interfaces: parcelable public final class healthdata extends object implements parcelable this class presents a health data object for a specified health data type, e.g. the blood pressure or weight. handling health data quantitative and qualitative values of health data can be specified through this class. set each property value of health data based on its data type definition and manage it with healthdataresolver. the data type definitions are described in samsung health's data types. example see inserting health data. since: 1.0.0 constructor summary constructors constructor and description healthdata() creates a health data instance. method summary all methods instance methods concrete methods modifier and type method and description void clear() clears values of all properties in the health data object. byte[] getblob(string key) gets a blob value associated with a given property. double getdouble(string key) gets a double value associated with a given property. float getfloat(string key) gets a float value associated with a given property. inputstream getinputstream(string key) gets an inputstream associated with a given property. int getint(string key) gets an integer value associated with a given property. long getlong(string key) gets a long value associated with a given property. string getsourcedevice() gets the source device which provides health data. string getstring(string key) gets a text value associated with a given property. string getuuid() gets the unique id of the object. void putblob(string key, byte[] value) inserts a blob value into a given property of the health data object. void putdouble(string key, double value) puts a double value into the given property of the health data object. void putfloat(string key, float value) puts a float value into a given property of the health data object. void putinputstream(string key, inputstream value) inserts an inputstream into a given property of the health data object. void putint(string key, int value) puts an integer value into a given property of the health data object. void putlong(string key, long value) puts a long value into a given property of the health data object. void putnull(string key) inserts a null value into a given property of the health data object. void putstring(string key, string value) puts a text value into a given property of the health data object. void setsourcedevice(string deviceuuid) sets the source device which provides health data. constructor detail healthdata public healthdata() creates a health data instance. since: 1.0.0 method detail getuuid public string getuuid() gets the unique id of the object. use getstring() to get the data's uuid from a result in: healthdataresolver.aggregateresult healthdataresolver.readresult returns: the unique id contained in the object throws: unsupportedoperationexception - if the health data is in healthdataresolver.aggregateresult or healthdataresolver.readresult since: 1.0.0 getsourcedevice public string getsourcedevice() gets the source device which provides health data. returns: the id of the source device which provides health data since: 1.0.0 setsourcedevice public void setsourcedevice(string deviceuuid) sets the source device which provides health data. it's mandatory to set the source device for created health data. parameters: deviceuuid - the source device id which provides health data since: 1.0.0 getstring public string getstring(string key) gets a text value associated with a given property. parameters: key - the specific property name of health data that its value type is text. e.g. healthconstants.exercise.comment returns: the text value, or null if the health data object does not have the given property since: 1.0.0 getfloat public float getfloat(string key) gets a float value associated with a given property. parameters: key - the specific property name of health data that its value type is float. e.g. healthconstants.exercise.distance returns: the float value, or 0.0f if the health data object does not have the given property since: 1.0.0 getdouble public double getdouble(string key) gets a double value associated with a given property. parameters: key - the specific property name of health data that its value type is double returns: the double value, or 0.0d if the desired type does not exist for the given property since: 1.0.0 getlong public long getlong(string key) gets a long value associated with a given property. parameters: key - the specific property name of health data that its value type is long. e.g. healthconstants.exercise.duration returns: the long value, or 0l if the desired type does not exist for the given property since: 1.0.0 getint public int getint(string key) gets an integer value associated with a given property. parameters: key - the specific property name of health data that its value type is integer. e.g. healthconstants.bloodglucose.measurement_type returns: the integer value, or 0 if the desired type does not exist for the given property since: 1.0.0 getblob public byte[] getblob(string key) gets a blob value associated with a given property. parameters: key - the specific property name of health data that its value type is blob. e.g. healthconstants.exercise.live_data returns: the blob value, or null if the desired type does not exist for the given property since: 1.0.0 getinputstream public inputstream getinputstream(string key) gets an inputstream associated with a given property. parameters: key - the specific property name of health data that its value type is file. e.g. healthconstants.healthdocument.document returns: the inputstream object, or null if the desired type does not exist for the given property since: 1.3.0 putint public void putint(string key, int value) puts an integer value into a given property of the health data object. the existing value for the property is replaced. parameters: key - the health data's specific property name that its value type is integer. e.g. healthconstants.bloodglucose.measurement_type value - the integer value for the given property since: 1.0.0 putlong public void putlong(string key, long value) puts a long value into a given property of the health data object. the existing value for the property is replaced. parameters: key - the health data's specific property name that its value type is long. e.g. healthconstants.exercise.duration value - the long value for the given property since: 1.0.0 putfloat public void putfloat(string key, float value) puts a float value into a given property of the health data object. the existing value for the property is replaced. parameters: key - the health data's specific property name that its value type is float. e.g. healthconstants.exercise.distance value - the float value for the given property since: 1.0.0 putdouble public void putdouble(string key, double value) puts a double value into the given property of the health data object. the existing value for the property is replaced. parameters: key - the health data's specific property name that its value type is double value - the double value for the given property since: 1.0.0 putstring public void putstring(string key, string value) puts a text value into a given property of the health data object. the existing value for the property is replaced. parameters: key - the health data's specific property name that its value type is text. e.g. healthconstants.exercise.comment value - the text value for the given property since: 1.0.0 putblob public void putblob(string key, byte[] value) inserts a blob value into a given property of the health data object. the existing value for the property is replaced. parameters: key - the health data's specific property name that its value type is blob e.g. healthconstants.exercise.live_data value - the blob value for the given property since: 1.0.0 putinputstream public void putinputstream(string key, inputstream value) inserts an inputstream into a given property of the health data object. the existing value for the property is replaced. parameters: key - the health data's specific property name that its value type is file e.g. healthconstants.healthdocument.document value - the inputstream object for the given property since: 1.3.0 putnull public void putnull(string key) inserts a null value into a given property of the health data object. the existing value for the property is replaced. parameters: key - the health data's specific property name since: 1.1.0 clear public void clear() clears values of all properties in the health data object. since: 1.0.0

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

      doc

      faq

      faq what are the main features of the samsung privileged health sdk? the main features of the samsung privileged health sdk include: tracking raw and processed health sensor data on galaxy watch getting data for multiple health sensors for information about the available trackers, see what data is provided. some health tracker types are “batching”: accelerometer heart rate ppg green. batching collects measured sensor data and periodically invokes a tracking event listener. for example, every 12 seconds for ppg green. this enables the watch’s sensor data to be tracked continuously and provide more granular results while conserving battery life. how do i get access to the samsung privileged health sdk? to use the samsung privileged health sdk, request for the samsung partner program. when your request is reviewed, you receive information about how to access the sdk content. does the samsung privileged health sdk work on android phones? no. the samsung privileged health sdk supports only galaxy watch4 and later models running wear os powered by samsung. it does not support other mobile devices, such as smartphones. can supported health tracker types of the samsung privileged health sdk differ depending on the galaxy watch model or wear os version? yes. the supported health tracker types can differ depending on the specific galaxy watch model and the watch software version. the samsung privileged health sdk provides a capability check api. it retrieves which tracker types are available on the user’s watch and can therefore be used by your application. can i read data from more than 1 health tracker simultaneously? yes, depending on the tracker type. there are 2 tracker types: on-demand, such as bia (body composition) and ecg (electrocardiogram) batching, such as accelerometer and heart rate only 1 on-demand tracker can be used at a time. multiple batching trackers can be used simultaneously. the measure blood oxygen level and heart rate on galaxy watch code lab demonstrates how to implement running 2 types of trackers concurrently. notethe heart rate and ppg green trackers give invalid results while tracking bia. they return to normal functionality after the bia measurement. is there emulator support for developing applications with the samsung privileged health sdk? no. the samsung privileged health sdk doesn't support the emulator. development with the sdk requires the galaxy watch device. can i detect when users take the galaxy watch off their wrist? yes, depending on the tracker. for the heart rate, spo2, bia (body composition), and sweat loss trackers, you can use the samsung privileged health sdk to monitor the status field with the update listener. for example, a heart rate status value of “-3” means that the wearable is not being worn. for information about other status values and trackers, refer to the documentation. alternatively, you can check the sensor.type_low_latency_offbody_detect value. for more information, see sensorevent. does the samsung privileged health sdk receive its data through samsung health? no. the samsung privileged health sdk does not share data with samsung health. health services also provides heart rate tracking. how is heart rate tracking with the samsung privileged health sdk different? the samsung privileged health sdk provides heart rate data tracking with ibi (inter-beat interval), which can be used to calculate hrv (heart rate variability). this information can be used for more detailed analysis. the android sensor manager also provides accelerometer tracking. how is accelerometer tracking with the samsung privileged health sdk different? the accelerometer tracking provided by the samsung privileged health sdk records data samples with 25hz resolution in batches of 12 seconds (300 samples). batching reduces battery consumption and enables you to track data over longer durations.

      https://developer.samsung.com/health/privileged/faq.html
      1. Develop
      2. Health

      api

      HealthConnectionErrorResult

      overview package class tree deprecated index com.samsung.android.sdk.healthdata class healthconnectionerrorresult java.lang.object com.samsung.android.sdk.healthdata.healthconnectionerrorresult public final class healthconnectionerrorresult extends object this class handles errors raised by connection failure to the health data store. considerations for connection failure a partner app works with samsung health. the partner app can meet the following error cases when it connects to samsung health. connection error description platform_not_installed samsung health is not installed. old_version_platform installed samsung health's version is old. platform_disabled samsung health is disabled. user_agreement_needed the user didn't agree to samsung health's terms & conditions and privacy policies. user_password_needed samsung health is locked by the user password. handling connection exceptions samsung health sdk for android helps you to handle all available error cases with healthconnectionerror when your application connects to the health data store. healthconnectionerror is retrieved in healthdatastore.connectionlistener's event handler and all samsung health's partner applications need to check the health data store's connection error mandatorily. the following example shows how to handle the connection error. public class mainactivity extends activity { private healthdatastore mstore; private healthconnectionerrorresult mconnerror; private static mainactivity minstance = null; @override public void oncreate(bundle savedinstancestate) { // ... mstore = new healthdatastore(this, mconnectionlistener); mstore.connectservice(); } @override public void ondestroy() { mstore.disconnectservice(); // ... } private final healthdatastore.connectionlistener mconnectionlistener = new healthdatastore.connectionlistener() { @override public void onconnected() { // connected } @override public void onconnectionfailed(healthconnectionerrorresult error) { // connection fails showconnectionfailuredialog(error); } @override public void ondisconnected() { // connection is disconnected } }; private void showconnectionfailuredialog(healthconnectionerrorresult error) { alertdialog.builder alert = new alertdialog.builder(this); mconnerror = error; if (mconnerror.hasresolution()) { switch(error.geterrorcode()) { case healthconnectionerrorresult.platform_not_installed: message = "please install samsung health"; break; case healthconnectionerrorresult.old_version_platform: message = "please upgrade samsung health"; break; case healthconnectionerrorresult.platform_disabled: message = "please enable samsung health"; break; case healthconnectionerrorresult.user_agreement_needed: message = "please agree to samsung health policy"; break; default: message = "please make samsung health available"; break; } } else { // in case that the device doesn't support samsung health, // hasresolution() returns false also. alert.setmessage(r.string.msg_conn_not_available); } alert.setpositivebutton(r.string.ok, (dialog, id) -> { if (error.hasresolution()) { error.resolve(mainactivity.this); } }); if (error.hasresolution()) { alert.setnegativebutton("cancel", null); } alert.show(); } } since: 1.0.0 see also: healthdatastore.connectionlistener field summary fields modifier and type field and description static int connection_failure the connection is not established in the health data framework. static int old_version_platform the version of the health data framework is outdated to cooperate with sdk. static int old_version_sdk the sdk's data library version is outdated to cooperate with the samsung health's health data framework. static int platform_disabled the health data framework is disabled. static int platform_not_installed samsung health is not installed. static int platform_signature_failure it fails to check the signature of the health data framework. static int timeout the connection time exceeded the limit. static int unknown unknown error. static int user_agreement_needed the user did not agree to terms and conditions, and privacy policy of samsung health yet. static int user_password_needed the user cancels the password input explicitly on the password pop-up window. method summary all methods instance methods concrete methods modifier and type method and description int geterrorcode() gets the error code of connection failure. boolean hasresolution() checks whether the given error has a resolution. void resolve(activity activity) resolves an error with an activity which is able to get the user's feedback for possible error cases. field detail unknown public static final int unknown unknown error. its constant value is 0. since: 1.0.0 see also: constant field values connection_failure public static final int connection_failure the connection is not established in the health data framework. its constant value is 1. since: 1.0.0 see also: constant field values platform_not_installed public static final int platform_not_installed samsung health is not installed. to resolve it: if your app runs on android 11, check your app manifest whether the "<queries>" element is added. see the app manifest guide. call resolve(android.app.activity). it leads the user to install samsung health on an app seller site. its constant value is 2. since: 1.0.0 see also: resolve(android.app.activity), constant field values old_version_sdk public static final int old_version_sdk the sdk's data library version is outdated to cooperate with the samsung health's health data framework. to resolve it: apply the latest data library to your app. if your app uses the latest data library, create an activity to update to install your latest app. its constant value is 3. since: 1.0.0 see also: constant field values old_version_platform public static final int old_version_platform the version of the health data framework is outdated to cooperate with sdk. to resolve it, call resolve(android.app.activity). it leads the user to install the latest samsung health on an app seller site. its constant value is 4. since: 1.0.0 see also: resolve(android.app.activity), constant field values timeout public static final int timeout the connection time exceeded the limit. its constant value is 5. since: 1.0.0 see also: constant field values platform_disabled public static final int platform_disabled the health data framework is disabled. to resolve it, call resolve(android.app.activity). it leads the user to activate samsung health through the phone's settings. its constant value is 6. since: 1.0.0 see also: resolve(android.app.activity), constant field values user_password_needed public static final int user_password_needed the user cancels the password input explicitly on the password pop-up window. some devices can request a password to protect the user's data. the password for the health data access can be registered in samsung health by the user. then the user can enter the password through the password pop-up window. if the predetermined time passed without the valid password input, timeout occurs. its constant value is 7. since: 1.0.0 see also: constant field values platform_signature_failure public static final int platform_signature_failure it fails to check the signature of the health data framework. its constant value is 8. since: 1.0.0 see also: constant field values user_agreement_needed public static final int user_agreement_needed the user did not agree to terms and conditions, and privacy policy of samsung health yet. the health data framework is not activated before agreement. to resolve it, call reslove. it leads the user to the samsung health's service agreement page. its constant value is 9. since: 1.0.0 see also: resolve(android.app.activity), constant field values method detail geterrorcode public int geterrorcode() gets the error code of connection failure. usually it is called in healthdatastore.connectionlistener.onconnectionfailed(healthconnectionerrorresult). it's required to resolve the error depending on its returned error code. returns: the error code since: 1.0.0 hasresolution public boolean hasresolution() checks whether the given error has a resolution. whether the device supports samsung health the sdk supports marshmallow and above android devices including non-samsung devices. and it works with samsung health. there is no connection issue on most devices but it is not available occasionally depending on the device's specification. this api lets you know whether the device supports samsung health. the returned false involves that the device is not available for samsung health. precondition: check the network connection. permission: android.permission.internet returns: true if the platform provides a resolution for the error. call resolve(activity). false in the following cases: if the device doesn't support samsung health if there is no resolution for the error since: 1.0.0 resolve public void resolve(activity activity) resolves an error with an activity which is able to get the user's feedback for possible error cases. it handles the following errors and operations. show a proper message for each error case in your application before call this method. error operation platform_not_installed linked to the application installation page old_version_platform linked to the application installation page platform_disabled linked to settings of the device to turn on samsung health user_agreement_needed linked to the starting screen of samsung health to get the user's agreement precondition: check the network connection. permission: android.permission.internet parameters: activity - an activity which resolves the error with the user's feedback. usually it's the main activity of your application. throws: illegalargumentexception - if the specified input is null or invalid since: 1.0.0

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

      doc

      Enviroment

      development environment check prerequisites first and follow all steps below to create a samsung health’s partner app. prerequisites check following prerequisites before downloading samsung health sdk for android. android version android 8.0 oreo (api level 26) or above available devices android smartphones including non-samsung devices samsung health version a partner app runs with samsung health 4.0 or higher downloading samsung health sdk for android the sdk can be downloaded on the samsung developer site. folder in sdk description docs api reference describes the sdk's health data apis. programming guide contains development information to create a samsung health's partner app with health data access. libs samsung-health-data-va.b.c.aar health data library of samsung health sdk for android. samples simplehealth sample application that demonstrates how to read step count data. stepdiary sample application that demonstrates how to read step count and daily step count trend data. foodnote sample application to check daily calorie intake. tools dataviewer.apk a test tool for the connection between your app and samsung health that works via the samsung health's developer mode. it reads samsung health's saved data.

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

      doc

      FAQ

      faq common | what are the benefits of samsung health sdk for android? samsung health app is a most popular health app and has more than 50 million of monthly active users. it works not only on samsung smartphones but also non-samsung phones if the device supports android marshmallow or above. it consists a big ecosystem including various health apps and connected accessory devices. samsung health sdk for android enables your app to manage the user’s health data with the unified interface by connecting to samsung health app. you can have more enhanced chances with a partnership of samsung health. common | i know the sdk needs samsung health installation. can samsung health be installed to all phones? if not, how can i know the samsung health’s availability on the device? even though samsung health is installed in android smartphones with marshmallow or above including samsung and non-samsung smartphones, some phones cannot support samsung health. its check code needs to be added to prevent a relevant situation. the sdk’s health data provides a solution to check it through healthconnectionerrorresult.hasresolution(). if the app meets the following cases, it means that the device is not available for samsung health. healthdatastore.connectservice() gives a failure event. healthconnectionerrorresult.hasresolution() returns false. see an example for failure exception handling. health data | i would like to know data’s common properties. all data type interfaces extend the healthconstants.common interface basically. some data types extend healthconstants.discretemeasurement and others extend healthconstants.sessionmeasurement depending on whether the end measured time exists. for example, healthconstants.sleep extends: healthconstants.common healthconstants.sessionmeasurement you can set healthconstants.sleep's following properties including its own ones. healthconstants.common.device_uuid healthconstants.sessionmeasurement.start_time healthconstants.sessionmeasurement.end_time see the "properties" description of each data type interface in api reference for more information. sleep data can be set as the example shown below. public class healthdataexample { // the state of connection private healthdatastore mstore; private void insertsleepdata(long start, long end, long offset) { healthdevice mydevice = new healthdevicemanager(mstore).getlocaldevice(); healthdata data = new healthdata(); data.setsourcedevice(mydevice.getuuid()); // fills all mandatory properties out data.putlong(healthconstants.sleep.start_time, start); data.putfloat(healthconstants.sleep.end_time, end); data.putlong(healthconstants.sleep.time_offset, offset); healthdataresolver resolver = new healthdataresolver(mstore, null); healthdataresolver.insertrequest insrequest = new healthdataresolver.insertrequest.builder() .setdatatype(healthconstants.sleep.health_data_type) .build(); // do something } } health data | there are two data types for steps. which data type is better? handling all use cases for the phone and linked multi-accessory devices is not easy with it because the phone and accessory device like galaxy watch can provide step count data at the same time or not depending on how many devices are carried by the user. samsung health sdk provides the following data types for steps: healthconstants.stepdailytrend healthconstants.stepcount healthconstants.stepdailytrend is used to generally to read the user’s daily steps. especially, its source_type_all provides the day’s total steps simply without excluding duplicated steps when the user carries one more devices at the same time. healthconstants.stepcount is useful for: getting each source device’s step count getting real-time step count of the phone that samsung health is installed. health data | the inserted health data’s measured time looks different. how can i solve it? if new data is inserted to the health data store, created_time, updated_time of healthconstants.common are assigned by the system automatically. so you don’t need to set them separately. data’s start_time or end_time indicates its utc measurement time in milliseconds. be careful not to set start_time or end_time as the device’s current local time. time_offset is indicated by the time zone and daylight saving time in milliseconds and it helps in showing the health data’s measured time properly in the device. the following example shows getting the current device’s time_offset. import java.util.timezone; public class heathdataexample { long gettimeoffset(long intaketime) { return timezone.getdefault().getoffset(intaketime); } }

      https://developer.samsung.com/health/android/faq.html
      1. Develop
      2. Health

      doc

      Overview

      samsung privileged health sdk the galaxy watch is equipped with samsung’s unique bioactive sensor that drives the next era of digital health monitoring. first introduced on the galaxy watch4 series, the bioactive sensor uses a single unique chip that combines three powerful health sensors — optical heart rate, electrical heart signal, and bioelectrical impedance analysis — to deliver extensive readings that include heart rate and blood oxygen level. what is samsung privileged health sdk the samsung privileged health sdk is specialized for galaxy watch4 devices or later. it provides both raw sensor signal data from the samsung bioactive sensor and processed data with our differentiated features. the sdk supports an improved health tracking capability to allow your applications to track the user's health data accurately with the accelerometer, raw ecg (electrocardiogram), ppg (photoplethysmogram), and heart rate including inter-beat interval. in addition, it provides more advanced health features such as the body composition measurement, to enable compelling use cases for health and fitness applications. the blood oxygen level and sweat loss after a running workout are also useful data to check a user's health status. what you can do a watch application using the samsung privileged health sdk runs on a galaxy watch with wear os powered by samsung. it will help users to monitor their overall health data and to provide an advanced healthy life. the sdk can be utilized in various fields such as fitness, remote patient monitoring, senior care, digital therapy, fatigue risk management, and corporate wellness. what are the advantages let's review more advantages of the samsung privileged health sdk. low watch battery consumption the samsung privileged health sdk's accelerometer data, ppg green data, and heart rate data are all received as a batching event. the sdk's batching operation gathers sensor data in an application processor without waking up the cpu and sends an event at specific periods to a watch application. this minimizes the watch's battery consumption and enables a watch application to track the user's status for the entire day. receiving raw sensor data the accelerometer, ecg, and ppg green data are provided as raw data by the samsung privileged health sdk. this is very useful to conduct various analyses and more in-depth research with your own algorithm. using galaxy watch specific features measuring the user's body composition, blood oxygen level, heart rate including the inter-beat interval, and sweat loss after a running workout is a feature specific to the galaxy watch. using the privileged health sdk, your watch application can easily measure these data. what data is provided the following data types are supported by the samsung privileged health sdk: data type details accelerometer raw x, y, and z axis data. provided as a batching event. bia body composition data. provided as an on-demand event. ecg raw electrocardiogram data. provided as an on-demand event. heart rate heart rate data, including inter-beat interval. provided as a batching event. ppg green raw data from ppg green led. provided as a batching event. ppg ir raw data from ppg infrared led. provided as an on-demand event. ppg red raw data from ppg red led. provided as an on-demand event. skin temperature skin temperature data. provided as a batching and on-demand events. spo2 blood oxygen level. provided as an on-demand event. sweat loss lost water amount after a running workout. provided as an on-demand event. experience samsung privileged health sdk you can practice using the samsung privileged health sdk with our code labs. visit code lab to get started. code labgalaxy watch, health measure blood oxygen level on galaxy watch code labgalaxy watch, health measure blood oxygen level and heart rate on galaxy watch partner app program our partner app program is an exclusive service for the samsung privileged health sdk that allows users to discover engaging health and fitness applications. the samsung privileged health sdk is now available for selected partners and we are reviewing all applications to join. apply for partner app program restrictions the samsung privileged health sdk only works on galaxy watch4 devices or later models running wear os powered by samsung. samsung privileged health sdk does not support an emulator.

      https://developer.samsung.com/health/privileged/overview.html
      1. Develop
      2. Health

      api

      HealthDataResolver.InsertRequest

      overview package class tree deprecated index com.samsung.android.sdk.healthdata interface healthdataresolver.insertrequest enclosing class: healthdataresolver public static interface healthdataresolver.insertrequest this interface is able to make a request to insert health data for the specific health data type. request for inserting data healthdataresolver.insert() helps that your application saves a new measured data to samsung health. the following information is mandatory to build an insertrequest instance. mandatory information description data type set the data type with: insertrequest.builder.setdatatype() source device the device id that provides health data. set it with: healthdata.setsourcedevice() data's mandatory properties set mandatory properties of the health data type by referring to: data type definition you can make a request instance with insertrequest.builder.build(). inserting data example you can save health data to samsung health with healthdataresolver.insert() after setting detailed property values of the created healthdata instance. the health data framework registers the current device where your application is installed. if the source device is the current device, its id can be checked as shown below. // the state of connection private final healthdatastore mstore; public static final string app_tag = "myapp"; private void insertglucose(long start, long offset, float value) { // set the source device as the current device healthdevice mydevice = new healthdevicemanager(mstore).getlocaldevice(); healthdata data = new healthdata(); data.setsourcedevice(mydevice.getuuid()); and the data instance's properties including mandatory ones needs to be set. // set properties including mandatory ones data.putlong(healthconstants.bloodglucose.start_time, start); data.putlong(healthconstants.bloodglucose.time_offset, offset); data.putint(healthconstants.bloodglucose.measurement_type, healthconstants.bloodglucose.measurement_type_whole_blood); the measured data value needs to be set after checking defined data unit. each property in api reference lets you know it. in this case, see healthconstants.bloodglucose.glucose data.putfloat(healthconstants.bloodglucose.glucose, value); an insertrequest instance is created by insertrequest.builder.build() with setting the data type. it's ready to add data to samsung health if the data is added to the insertrequest. healthdataresolver.insertrequest insrequest = new healthdataresolver.insertrequest.builder() .setdatatype(healthconstants.bloodglucose.health_data_type) .build(); // add health data insrequest.addhealthdata(data); healthdataresolver resolver = new healthdataresolver(mstore, null); try { resolver.insert(insrequest).setresultlistener(mistresult); } catch (exception e) { log.d(app_tag, "resolver.insert() fails."); } } healthdataresolver.insert(com.samsung.android.sdk.healthdata.healthdataresolver.insertrequest) sends a request to samsung health. a data validation exception is received in healthresultholder.baseresult. it gives a request's result state and a number of inserted data. private final healthresultholder.resultlistener<healthresultholder.baseresult> mistresult = new healthresultholder.resultlistener<healthresultholder.baseresult>(){ @override public void onresult(healthresultholder.baseresult result) { if(result.getstatus() != status_successful) { // check the error } else { // check the count of inserted data log.d(app_tag, "count of inserted data: " + result.getcount()); } } }; since: 1.0.0 nested class summary nested classes modifier and type interface and description static class healthdataresolver.insertrequest.builder this class is a builder to configure healthdataresolver.insertrequest. method summary all methods instance methods abstract methods modifier and type method and description void addhealthdata(healthdata object) adds health data to insert. void addhealthdata(list<healthdata> objectlist) adds a health data list to insert. method detail addhealthdata void addhealthdata(healthdata object) adds health data to insert. parameters: object - the health data instance. the source device of object should be valid. throws: illegalargumentexception - if source device is not set or data is null since: 1.0.0 addhealthdata void addhealthdata(list<healthdata> objectlist) adds a health data list to insert. parameters: objectlist - the list of health data objects. the source device for each health data has to be defined in advance. throws: illegalargumentexception - if source device is not set or data list is null since: 1.0.0

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

      doc

      Release Note

      release note introduction release date: september 26, 2019 release contents health device specs ble compatible guidelines for following health devices:blood glucose meterblood pressure monitorheart rate monitorweight scalesamsung health specifications for following health devices:exercise monitorenhanced heart rate monitorpedometersleep monitorsamsung health specification for multiple health service devices:handling multiple data typessetting user info verification tool it checks overall implementation of your health device for whole samsung health’s device specs. change history sep 26, 2019 [update] tools testapps_weight.apk and verificationtool.apk are updated. a pop-up displays for a device’s location access if it is not enabled. april 11, 2019 [new feature] weight scale user data service is defined for a multiple user scenario. see its spec 2.0. [update] tools testapps_weight.apk and verificationtool.apk are updated as a weight scale spec update. nov 23, 2017 the following tools to test your health device are added. test apps verification tool oct 17, 2017 samsung health device sdk v1.0.0 a new sdk release

      https://developer.samsung.com/health/device/release-note.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
      • SamsungOpen 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.