Module: SHealth

Members

(static) DataType :string

Represents the SHealth HealthConstants string representation.
Type:
  • string
Properties:
Name Type Description
DAILY_STEP_COUNT string
BLOOD_PRESSURE string
TEMPERATURE string
HEART_RATE string
SPO2 string
GLUCOSE string
HBA1C string
WEIGHT string
FOOD_INFO string
FOOD_INTAKE string
WATER_INTAKE string
CAFFEINE_INTAKE string
EXERCISE string
SLEEP string
SLEEP_STAGE string
Source:

(static) EventName :string

The window event names for events generated by SHealth
Type:
  • string
Properties:
Name Type Description
ON_SHEALTH_PERMISSIONS string
ON_SHEALTH_ERROR string
ON_SHEALTH_RECORDS string
ON_SHEALTH_HISTORY string
Source:

(static) HistoricalSet :string

Each Historical set is a collection of SHealth DataType that is used to fetch 6 months of corresponding data from SHealth.
Type:
  • string
Properties:
Name Type Description
ROUTINE string
FITNESS string
Source:

(static) SHealthError :string

The SHealth errors that can be reported through onPermissionError.
Type:
  • string
Properties:
Name Type Description
MISSING_USER string
RESOLVING_CONNECTION_FAILED string
CONNECTION_FAILED string
INVALID_DATA_TYPE string
INVALID_PERMISSION string
Source:

(static) SubscriptionSet :number

Each Subscription set is a collection of SHealth DataType that when used add subscriptions for multiple DataTypes.
Type:
  • number
Properties:
Name Type Description
ROUTINE number
DIABETES number
WEIGHT number
FITNESS number
SLEEP number
NUTRITION number
BLOOD_PRESSURE number
Source:

Methods

(static) addSubscriptions(dataTypes)

Add an array of DataType values to receive records through SHealth for.
Parameters:
Name Type Description
dataTypes Array.<DataType> An array of DataType to add a subscription for to receive records through SHealth.
Source:

(static) addSubscriptionSets(subscriptionSet)

Add an array of SubscriptionSet values to receive records through SHealth for.
Parameters:
Name Type Description
subscriptionSet Array.<SubscriptionSet>
Source:

(static) fetchHistoricalSets(historyOptions)

Fetch historical data for the specified sets across the specified dates.
Parameters:
Name Type Description
historyOptions HistoryOptions | Array.<HistoricalSet> HistoricalSet and Date query options HistoricalSet.ROUTINE and HistoricalSet.FITNESS are supported. If a listener has been set using SHealth.setSHealthListener a summary will be returned for any records pulled from history.
Source:

(static) getSubscriptionsFromSet(The, The, The)

Returns the set of #DataType associated with a #SubscriptionSet
Parameters:
Name Type Description
The SubscriptionSet subscription set to return data types for
The DataTypeCallback success callback for returning the array of datatypes
The FailCallback error callback
Source:

(static) isSHealthAvailable(callback)

Checks whether this device is an Android device and if SHealth is installed.
Parameters:
Name Type Description
callback AvailableCallback
Source:

(static) observeCurrentSubscriptions()

Starts the SHealth Service if it is not already started. It will report back gathered permissions through onPermissionChanged with a PermissionChangeHandler or OnPermission error with an SHealthError.
Source:

(static) onPermissionChanged(obj)

Parameters:
Name Type Description
obj PermissionChangeHandler Callback with gathered permissions.
Deprecated:
  • use setSHealthListener Success callback for SHealth. Overload this function to receive notifications for SHealth Permission changes.
Source:

(static) onPermissionError(err)

Parameters:
Name Type Description
err SHealthError Error from SHealth.
Deprecated:
  • use setSHealthListener Error callback for SHealth. Overload this function to receive notifications for SHealth Permission Errors.
Source:

(static) removeSubscriptions(dataTypes)

Remove subscriptions to a group of DataType from SHealth.
Parameters:
Name Type Description
dataTypes Array.<DataType>
Source:

(static) removeSubscriptionSets(subscriptionSets)

Remove an array of SubscriptionSet values from SHealth.
Parameters:
Name Type Description
subscriptionSets
Source:

(static) setSHealthListener(listeners)

Set a listener for SHealth events from SHealth.
Parameters:
Name Type Description
listeners SHealthHandlers Callbacks for events from SHealth
Source:

Type Definitions

HistoryOptions

Source: