com.samsung.android.sdk.healthdata
See: Description
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.
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.
The SDK provides useful predefined and custom data types. See Health Data Types for more information.
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.
Samsung Health SDK for Android works with Samsung Health. The SDK's data library works properly with the specific Samsung Health version.
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.
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(); }
HealthConnectionErrorResult.onConnectionFailed()
private final HealthDataStore.ConnectionListener mConnectionListener = new HealthDataStore.ConnectionListener() { // ... @Override public void onConnectionFailed(HealthConnectionErrorResult error) { // ... }
@Override public void onConnectionFailed(HealthConnectionErrorResult error) { if (error.getErrorCode() == HealthConnectionErrorResult.OLD_VERSION_PLATFORM) { // Show a message to the user to update Samsung Health } }
HealthConnectionErrorResult.hasResolution()
HealthConnectionErrorResult.resolve()
if (error.hasResolution()) { // If there is a solution, resolve it error.resolve(MainActivity.this); }
See its example: