• 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. news | health, ai, galaxy watch, design, game

      news

      April 2023 Newsletter: Samsung Health Stack 1.0 revealed before official release and other latest news

      did you miss out on the latest samsung developers newsletter? catch up now. if you don't currently receive the newsletter, you can subscribe here.

      https://developer.samsung.com/sdp/news/en-us/2023/04/27/april-2023-newsletter-samsung-health-stack-10-revealed-before-official-release-and-other-latest-news
      1. Develop
      2. Health

      doc

      Connection Design Guide

      connection design guide samsung health's partner apps can connect to samsung health with samsung health sdk for android. a partner app needs to inform samsung health users that the app connects with samsung health and that it shares data. the connection design guide provides connection flows with unified look and feel for partner apps. notification of samsung health connection menu for connecting to samsung health permission setting menu samsung health name and icon notification of samsung health connection the launch screen of a partner app, event pop-up, or information space is a good approach to notify users of connecting with samsung health. a partner app needs to inform users with as concrete description and information as possible. do show explicitly a notification of working with samsung health as a partner app. the app's launch screen is recommended. do include a concrete description of the data synced with samsung health. do show the "samsung health" name or its icon. see the naming and icon guide. do add a ui flow to show the data permission pop-up after the notification message. menu for connecting to samsung health a partner app should provide a menu with a convenient interface for the user to change the data sync setting with samsung health. do create a menu to set the samsung health's data permission. do use a straightforward menu name like "connect to samsung health". recommended contents in "connect to samsung health" are: benefits available through samsung health connection and the data synced with samsung health link to samsung health do add an option to install samsung health through "connect to samsung health" if it is not installed. do show a samsung health's data permission popup through the menu. do place "connect to samsung health" where the user can find it easily. do not place "connect to samsung health" under multiple layers that are difficult for the user to find. samsung health name & icon samsung health's name and its icon in a partner app should be used properly. samsung health name - "samsung health" do use the name "samsung health". do not modify the official name, “samsung health”. examples of what to avoid are: shealth shealth s health s-health samsunghealth samsung health's icon do use the latest icon. you can get it here. its official icon is: samsung health's icon (april 11th, 2019) (185kb) do not modify the icon. do not use any other resource images of samsung health except its icon. do not use the samsung health's icon or similar icon for your own application.

      https://developer.samsung.com/health/android/connection-design.html
      1. Develop
      2. Health

      doc

      Introduction

      programming guide samsung health sdk for android helps samsung health's partners to share health data safely and to create useful health applications. samsung health has a health data store where its data can be shared with other partner apps after the user's consent. it supports android devices with marshmallow 6.0 including non-samsung devices. refer to the following table terms for samsung health sdk for android. term description health data framework it provides useful features to handle the user's health data. it is included in samsung health and its interface is provided with samsung health sdk for android. an app that uses the sdk works with samsung health. samsung health an application that helps monitor the user's activities and helps the users to have a healthier life through monitoring walking steps, exercise, heart rate, and etc. it can be downloaded from the app market like google play or galaxy apps. the term is italicized to be easily distinguished. health data framework the health data framework of samsung health sdk for android has the following features: health data store handling the connection to samsung health inserting, reading, updating, or deleting health data storing data based on unified units. see api reference's descriptions for each data type health data type platform-defined and custom data type privacy granting permission based on the user's consent to read or write the specific data type architecture the sdk's health data framework is designed to provide safe access of its data and to have a seamless health service to the user. the following figure shows the health data framework's architecture. health data framework the health data framework is included in samsung health. applications can access the user's data that are stored in samsung health through the sdk. it keeps the user's health data safely. health data from various source devices having pedometer, accelerator, or heart rate sensors are inserted to the health data framework with the unified data unit. the data can be read by the sdk. updating or deleting data is available if the app inserted the data. the figure above shows the class and interface relationships in health data. detailed descriptions for each class and interface are in the api reference. healthdatastore it handles the connection to the data storage of the device. it receives its connection result with healthdatastore.connectionlistener. most requests require the connection to the health data store. healthdataresolver the health data framework provides classes and interfaces to insert, read, update, or delete the data. healthdataresolver is a central class to handle the health data. it sends a data request with related request interfaces. the query result can be received immediately with healthdataholder.baseresult, healthdataresolver.readresult or healthdataresolver.aggregateresult. or it can be received asynchronously with healthresultholder.resultlistener. see health data store for more information. application developers can use platform-defined data types that samsung health sdk for android provides. see health data type for more information. especially healthconstants.common, the base interface of predefined data types, contains the following mandatory properties for health data. unique id of health data created and updated time of health data application package name device that provides health data the health data can be accessed with the user's consent. the following figure shows the relationship between classes and interfaces related to healthpermissionmanager. it requests permissions to the user with healthpermissionmanager.permissionkey to read or write for the specific health data type. the permission result can be received synchronous or asynchronously. see privacy for more information. the sdk's health data library provides the following package: com.samsung.android.sdk.healthdata main interfaces and classes in the library are described in the following table. see the api reference for details. interface / class description healthconnectionerrorresult this class handles errors for connection failure to the health data store. healthconstants this class defines constants of health data and contains interfaces for various kinds such as the step count or exercise. healthdata this class is an object for a health data type, e.g. the blood pressure or weight. quantitative and qualitative values can be defined for the specific health data type based on its data structure definition. it is used to manage health data with healthdataresolver. healthdataobserver this class defines an observer to handle health data changes. healthdataresolver this class accesses health data to insert, read, update, and delete with the filter and aggregate functions. healthdatastore this class handles the connection to the data store in the device. healthdataunit this class provides unified units for the health data store. healthdatautil this class provides useful utility apis. healthdevice this class contains detailed device information that provides health data. healthdevicemanager this class manages devices related health data. healthpermissionmanager this class requests permission to read or write health data for the specific health data type. healthresultholder this interface represents the result of invoking method. healthuserprofile this class provides the user information.

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

      doc

      Overview

      note : for android 11 (targetsdkversion 30), please add a <queries> element for the samsung health app in your app manifest. see hello health data for more details. note : there is a known issue that causes the health data permission to be removed after updating samsung health to version 6.19. if your app is affected by this, please guide the user to allow the permissions on your app again and update the samsung health app to the latest version. the issue has been solved in version 6.19.5. samsung health sdk for android samsung health sdk for android enables sharing health data between samsung health running on android phones and partner apps. it also enables partner apps to use samsung health's tracker feature through app creation with the sdk. samsung health's partner apps can provide their users with additional services with samsung health sdk for android. the sdk provides secure access to samsung health data with applicable data types. data sharing, however, is enabled only after the user's explicit consent. the user can select detailed data sharing settings including which partner app will access the user's data, and which data type will be read or written. furthermore, a partner app can launch a samsung health's tracker and define its own tracker tile. samsung health sdk for android provides the health data features. health data health data has the following features: health data store samsung health sdk for android keeps users' health data secured. the health data store handles the service connection. it facilitates reading samsung health's data or writing the partner's health data to samsung health. health data type it provides useful data types. each data type is designed to contain a given health data type's information. it is used to access the data in health data store. permissions and user controls the user's health data are sensitive information. handling data with the sdk is only available with the user's explicit consent. health data provides a unified user interface and gives the user control of the data sharing settings easily for each data type. partner apps program partner app program is an exclusive service for samsung health that allows users to discover engaging health and fitness applications. 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. sdk download after having a partnership with samsung health, download samsung health sdk for android and create your app. samsung health sdk for android | data (v1.5.0) nov 3, 2020 (1.62mb) connection design guide samsung health's partner apps connect to samsung health with samsung health sdk for android. unified interfaces in partner apps seamlessly connect with samsung health to provide uninterrupted user experience to the users. for the best result, please see connection design guide. notification of samsung health connection the launch screen of a partner app, event pop-up, or information space is a good approach to notify users of connecting with samsung health. a partner app needs to inform users with as concrete description and information as possible. menu for connecting to samsung health a partner app should provide a menu with a convenient interface for the user to change the data sync setting with samsung health. samsung health name & icon samsung health's name and its icon should be used properly in a partner app. restrictions samsung health android sdk requires samsung health installation. the latest sdk works with samsung health 6.12 or above. see the sdk and samsung health’s compatible versions here. samsung health runs on devices with android 8.0 oreo (api level 26) or above. it is available on all samsung smartphones and also non-samsung android smartphones. an app’s targetsdkversion that uses samsung health sdk for android should be 26 or above. the sdk provides apis to check whether the device supports the sdk. see faq for more information.

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

      api

      API Reference

      overview package class tree deprecated index samsung health android sdk - data api reference 1.5.0 health data this document describes com.samsung.android.sdk.healthdata apis in samsung health sdk for android. see: description packages package description com.samsung.android.sdk.healthdata this package provides classes and interfaces for the health data framework in samsung health sdk for android. health data this document describes com.samsung.android.sdk.healthdata apis in samsung health sdk for android. the health data package contains classes and interfaces which enable you to create applications with the following functionalities. health data store a partner app that uses samsung health sdk for android can write its health data to samsung health or read samsung health's data through the health data store connection. see health data store for more information. health data type the sdk provides useful predefined and custom data types. see health data types for more information. privacy data permission acquisition is required to access a specific data type. see permission manager for more information. for more information related to the development environment, fundamentals, features and sample descriptions, see programming guide. compatible version of samsung health samsung health sdk for android works with samsung health. the sdk's data library works properly with the specific samsung health version. sdk's heath data library version samsung health compatible version 1.5.0 6.12 or above 1.4.0 or above 6.2 or above 6.11 or below 1.3.0 5.11 or above6.1 or below 1.2.01.2.1 5.10 1.0.01.1.0 4.0 or above5.9 or below e.g. if you create your app with the health data library 1.5.0, it requires to install samsung health 6.12 or above in the device. if the sdk and samsung health's version is not matched, the sdk gives an error. old_version_platform you can resolve the error simply and induce the users to update samsung health to the latest version. here is a guide to prevent the related error. connect to the health data store. see healthdatastore.connectservice(). private healthdatastore mstore; @override public void oncreate(bundle savedinstancestate) { // create a healthdatastore instance and set its listener mstore = new healthdatastore(this, mconnectionlistener); // request the connection to the health data store mstore.connectservice(); } if it fails, check healthconnectionerrorresult.onconnectionfailed(). private final healthdatastore.connectionlistener mconnectionlistener = new healthdatastore.connectionlistener() { // ... @override public void onconnectionfailed(healthconnectionerrorresult error) { // ... } if the error is old_version_platform, it means that samsung health needs to be updated to the latest version. show a proper message to the user. @override public void onconnectionfailed(healthconnectionerrorresult error) { if (error.geterrorcode() == healthconnectionerrorresult.old_version_platform) { // show a message to the user to update samsung health } } check a resolution for the error with healthconnectionerrorresult.hasresolution(). if it gives true, resolve the error with healthconnectionerrorresult.resolve(). if (error.hasresolution()) { // if there is a solution, resolve it error.resolve(mainactivity.this); } the samsung health platform leads to upgrade samsung health on the app market. see its example: exception handing

      https://developer.samsung.com/health/android/data/api-reference/overview-summary.html
      1. Develop
      2. Health

      api

      HealthDeviceManager

      overview package class tree deprecated index com.samsung.android.sdk.healthdata class healthdevicemanager java.lang.object com.samsung.android.sdk.healthdata.healthdevicemanager public class healthdevicemanager extends object this class provides device information that is registered in the data framework and is able to register a new source device that provides health data. if a new data is saved to samsung health and its source device is new, the source device is registered to the health data framework automatically. a device with samsung health installed is recognized as the local device. registering a new source device separately is availble with healthdevice.builder.build() and registerdevice(healthdevice). the user's device that installed your application can meet many environments like: changing a phone and synchronizing samsung health data with the user's samsung account. all data in the old phone are moved to the new one. using an accessory such as galaxy watch with the phone. a data query need to be requested with varied considerations for your application and target devices. if you want to make that the query result contains only data your intended devices, set data's source devices for the data query such as with setsourcedevices() of healthdataresolver.readrequest.builder. otherwise, the query result can contain unintentional data of registered other accessories to samsung health. getting current device information the current device that samsung health runs is registered as the local device in the health data framework. if your application runs the current device and adds a new data to samsung health, set the data's source device as the local device. the following example shows how to get the current device information. public class heathdataexample { // the state of connection private healthdatastore mstore; void createhealthdata() { healthdata data = new healthdata(); // sets required properties // sets source device's uuid data.setsourcedevice(new healthdevicemanager(mstore).getlocaldevice().getuuid()); // adds new data to samsung health healthdataresolver resolver = new healthdataresolver(mstore, null); insertrequest request = new insertrequest.builder().setdatatype(nutrition.health_data_type).build(); request.addhealthdata(data); } } getting all registered devices' information samsung health works with accessories such as galaxy watch by the user's registration and can save the registered accessory's health data. also your application can work with a linked accessory and inserts its measured data to samsung health. you can get all registered devices to samsung health with getalldevices() and figure out other devices beside the current device that samsung health runs as the following example. //gets the current device healthdevicemanager devicemanager = new healthdevicemanager(mstore); string localuuid = devicemanager.getlocaldevice().getuuid(); // gets all registered devices list<healthdevice> healthdevices = new healthdevicemanager(mstore).getalldevices(); // checks registered devices beside the current device for (healthdevice device : healthdevices) { if (!device.getuuid().equals(localuuid)) { log.d(app_tag, "accessory's uuid: " + device.getuuid()); } } registering device to samsung health if you add data to samsung health and the data's source device is not registered yet on samsung health, register the data's source device before to adding data with registerdevice(healthdevice). since: 1.0.0 constructor summary constructors constructor and description healthdevicemanager(healthdatastore store) constructs and initializes an instance of healthdevicemanager. method summary all methods instance methods concrete methods modifier and type method and description boolean changecustomname(string uuid, string name) changes a custom name of the health device for a given device id. list<healthdevice> getalldevices() gets a list of all source devices in samsung health's saved data. healthdevice getdevicebyseed(string seed) gets a health device specified by a seed. healthdevice getdevicebyuuid(string uuid) gets a health device specified by an uuid. list<string> getdeviceuuidsbycustomname(string name) gets uuids of health devices for a given custom name. list<string> getdeviceuuidsbygroup(int group) gets uuids of devices for a given group. list<string> getdeviceuuidsbymanufacturer(string manufacturer) gets uuids of health devices for a given manufacturer. list<string> getdeviceuuidsbymodel(string model) gets uuids of health devices for a given device model. healthdevice getlocaldevice() gets a healthdevice object of the current device. string registerdevice(healthdevice device) registers a new source device that provides health data to the health data framework. constructor detail healthdevicemanager public healthdevicemanager(healthdatastore store) constructs and initializes an instance of healthdevicemanager. parameters: store - a connection with the health data store since: 1.0.0 method detail getlocaldevice public healthdevice getlocaldevice() gets a healthdevice object of the current device. samsung health sdk for android registers the current device where samsung health is installed. returns: the health device object throws: illegalstateexception - if the connection to the health data store is invalid or a remote-invocation error occurs on the connection since: 1.0.0 getalldevices public list<healthdevice> getalldevices() gets a list of all source devices in samsung health's saved data. it's different with getting all connected devices with samsung health. if a connected device didn't save its data to samsung health, the device is not included in this api's return. because this api gives only all device ids based on the saved data. an accessory that the user removes from samsung health's accessory list can be contained in its result if the accessory's data is saved in samsung health. returns: a list of registered all health device objects throws: illegalstateexception - if the connection to the health data store is invalid or a remote-invocation error occurs on the connection since: 1.0.0 registerdevice public string registerdevice(healthdevice device) registers a new source device that provides health data to the health data framework. parameters: device - the health device object to register returns: the registered device's id throws: illegalargumentexception - if the argument is null illegalstateexception - if the connection to the health data store is invalid or a remote-invocation error occurs on the connection since: 1.0.0 see also: healthdevice.builder.build() getdevicebyseed public healthdevice getdevicebyseed(string seed) gets a health device specified by a seed. parameters: seed - the unique value that identifies the device. it can be a wi-fi mac address, bluetooth address, or device's serial number. returns: a health device object for the seed throws: illegalargumentexception - if the argument is null illegalstateexception - if the connection to the health data store is invalid or a remote-invocation error occurs on the connection since: 1.0.0 getdevicebyuuid public healthdevice getdevicebyuuid(string uuid) gets a health device specified by an uuid. parameters: uuid - the uuid that represents the device returns: a health device object for the uuid throws: illegalargumentexception - if the argument is null illegalstateexception - if the connection to the health data store is invalid or a remote-invocation error occurs on the connection since: 1.0.0 getdeviceuuidsbygroup public list<string> getdeviceuuidsbygroup(int group) gets uuids of devices for a given group. parameters: group - the device group. it can be the following value. healthdevice.group_unknown healthdevice.group_mobile healthdevice.group_external healthdevice.group_companion returns: a list of uuids for devices that are specified with the group throws: illegalstateexception - if the connection to the health data store is invalid or a remote-invocation error occurs on the connection since: 1.0.0 getdeviceuuidsbycustomname public list<string> getdeviceuuidsbycustomname(string name) gets uuids of health devices for a given custom name. parameters: name - the custom name returns: a list of uuids for devices that are specified with the custom name. throws: illegalargumentexception - if the argument is null illegalstateexception - if the connection to the health data store is invalid or a remote-invocation error occurs on the connection since: 1.0.0 getdeviceuuidsbymodel public list<string> getdeviceuuidsbymodel(string model) gets uuids of health devices for a given device model. parameters: model - the model name returns: a list of uuids for devices that are specified with the model name throws: illegalargumentexception - if the argument is null illegalstateexception - if the connection to the health data store is invalid or a remote-invocation error occurs on the connection since: 1.0.0 getdeviceuuidsbymanufacturer public list<string> getdeviceuuidsbymanufacturer(string manufacturer) gets uuids of health devices for a given manufacturer. parameters: manufacturer - the manufacturer name returns: a list of uuids for devices that are specified with the manufacturer throws: illegalargumentexception - if the argument is null illegalstateexception - if the connection to the health data store is invalid or a remote-invocation error occurs on the connection since: 1.0.0 changecustomname public boolean changecustomname(string uuid, string name) changes a custom name of the health device for a given device id. parameters: uuid - the device id name - the new custom name of the device returns: true if the change is successful, or false if otherwise throws: illegalargumentexception - if the argument is null illegalstateexception - if the connection to the 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/HealthDeviceManager.html
      1. Develop
      2. Health

      doc

      Overview

      samsung health sdk for device samsung health provides a feature that allows users to discover compatible health devices. many health devices are bluetooth enabled and this is the primary method of interfacing with samsung health. the samsung health device sdk defines bluetooth low energy (ble) compatible guidelines and samsung health specifications based on bluetooth generic attributes (gatt), including service structure, to connect with samsung health. ble compatible guidelines include the data communication flows defined in ble standard specs that samsung health requires. through a wide variety of compatible health devices, users can sync data related to blood glucose levels, blood pressure, heart rate, and weight with samsung health. additionally, samsung health provides data flows and specifications for forthcoming supported services including pedometers and exercise and sleep monitors, which are not covered in standard ble specs. these standards are set forth in a familiar structure to standard ble standard specs, allowing device venders to easily adapt to the specifications. samsung health provides an easy interface to connect ble health devices as well as manage health data from these health devices. users will be able to measure and record their health history and enhance their experience by taking advantage of the many services provided through samsung health. upon approval, partners can use the “compatible with samsung health” seal on their devices or packaging. partner devices program samsung health supports various health and fitness accessories and equipment with support for connectivity protocols including ant and ble. connecting your ble device with samsung health sdk for device requires a partnership. 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 devices program at this time.

      https://developer.samsung.com/health/device/overview.html
      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
      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.