Programming GuideAug 24, 2017

Samsung Health is an application that monitors the user's activities and helps the user has a healthier life. Samsung Health's collected data can be categorized and expressed in various ways. It is important to present proper information to the user in the required time for advanced experiences. Samsung Health supports Android devices with KitKat 4.4 including non-Samsung devices.

Samsung Health SDK enables your app to work with Samsung Health. It provides the following packages.

  • Health Data

  • Health Service

The SDK can be downloaded from the developer site. See development environment for more information.

This document contains descriptions for the SDK's Health Service. See the Health Data's documents if you want to synchronize health data with Samsung Health.

The Health Service of Samsung Health SDK provides the tracker feature to:

Table 1 includes the SDK's Health Service glossary.

Term Description
Samsung Health An application that helps monitor the user's activities and helps the user makes a healthier life.
It contains the ‘main screen' area that shows tracker tiles.
It's written as italic in this document.
Tracker The tracker is the basic building block of Samsung Health.
See 6.1 for more information.
Tracker tile The tracker tile is a unit of viewer for the specific tracker on Samsung Health. It represents the latest data collected by its tracker and can be a gateway.
See 7.2 for more information.
Tracker items It's the item list that shows all trackers in Samsung Health.
Table 1: Glossary

Architecture

The SDK's Health Service is composed of the following features roughly.

  • Tracker manager

  • Tracker tile manager

The tracker manager provides information the Samsung Health' s tracker and helps to launch the Samsung Health' s available tracker.

The tracker tile manager provides the plugin service to install your app's tracker on Samsung Health. Your tracker is shown in the tracker item list page of Samsung Health with existing trackers if the application is registered as the partner application of Samsung Health. If the user subscribes to your app's tracker, its tile is posted to the Samsung Health' s main screen.

Figure 1 shows the architecture of the SDK’s Health Service and Samsung Health' s related features.

Figure 1: Architecture for SDK's Health Service and Samsung Health Figure 1: Architecture for SDK's Health Service and Samsung Health

Class Relationship

The SDK's Health Service library provides the following packages:

  • com.samsung.android.sdk.shealth

  • com.samsung.android.sdk.shealth.tracker

All APIs of the com.samsung.android.sdk.shealth.tracker package can be used after the following API succeeds.

  • Shealth.initialize(Context) of the com.samsung.android.sdk.shealth

com.samsung.android.sdk.shealth.tracker enables your app to use Samsung Health's tracker feature.

Figure 2 shows Health Service's class relationship.

Figure 2: Health Service's class relationship Figure 2: Health Service's class relationship

Each partner app can define only one tracker. Health Service's Plugin Service adds the app's defined tracker into the Samsung Health' s tracker items. TrackerEventListener receives Samsung Health' s tracker events. TrackerManager posts the app's tracker with TrackerTile with templates.

TrackerManager gets Samsung Health' s tracker information and helps your app to launch the tracker if it is available. Note that launching a Samsung Health' s tracker works on Samsung Health 4.8 or above.

Interfaces and classes of Health Service are described in Table 2. See API Reference for more information. You can find it under the [SamsungHealthSDK]/Service/Docs/API_Reference folder.

com.samsung.android.sdk.shealth
Interface / Class Description
Shealth This class is a representative class of the Health Service library. It helps on the usage of APIs in the com.samsung.android.sdk.shealth.tracker package.
com.samsung.android.sdk.shealth.tracker
Interface / Class Description
TrackerEventListener This interface defines event handlers related to your app's tracker in Samsung Health.
TrackerInfo This class provides tracker information.
It works on Samsung Health 4.8 or above.
TrackerManager This class provides S Health's tracker information and help to launch the Samsung Health's available tracker.
It works on Samsung Health 4.8 or above.
TrackerTile This class defines the app tracker's tile.
TrackerTileManager This class is used to post or remove a tracker tile on the Samsung Health.
Table 2: Interfaces and classes of the Health Service library