Namespace: FitnessTracker
Functions
UNSAFE_isTrackingAvailable
▸ UNSAFE_isTrackingAvailable(permission): Promise<boolean>
UNSAFE method to check if fitness tracking is available.
Platform
Android Returns if specific permission is authorized and available on Android
Platform
iOS Checks if data record of this type exists in HealthKit.
note For some data types, this method will return false even though permissions are allowed.
Because there might not be any records of that type in HealthKit.
This method should work fine with data types like steps because steps are always tracked in HealthKit.
Parameters
| Name | Type | Description |
|---|---|---|
permission | FitnessDataType | List of permissions to check if tracking is available |
Returns
Promise<boolean>
Defined in
api/fitnessTracker/UNSAFE_isTrackingAvailable.ts:24
authorize
▸ authorize(permissions): Promise<boolean>
Authorize tracking for provided permissions.
Parameters
| Name | Type | Description |
|---|---|---|
permissions | AuthorizationPermissions | List of permissions to track. |
Returns
Promise<boolean>
For iOS returns true if errors did not occur.
For Android returns true if user gave permission access.
Defined in
api/fitnessTracker/authorize.ts:14
getData
▸ getData(dataType): Promise<TodayAndDailyData>
Returns steps total for today and this week's steps daily values.
Parameters
| Name | Type |
|---|---|
dataType | FitnessDataType |
Returns
Promise<TodayAndDailyData>
Defined in
api/fitnessTracker/getData.ts:9
getLatestHeight
▸ getLatestHeight(): Promise<number>
Returns the latest height value or null if height does not exist.
Returns
Promise<number>
Defined in
api/fitnessTracker/getLatestHeight.ts:8
getLatestWeight
▸ getLatestWeight(): Promise<number>
Returns the latest weight value or null if weight does not exist.
Returns
Promise<number>
Defined in
api/fitnessTracker/getLatestWeight.ts:8
getStatisticTodayTotal
▸ getStatisticTodayTotal(dataType): Promise<number>
Gets statistic total for given data type for current day.
Parameters
| Name | Type |
|---|---|
dataType | FitnessDataType |
Returns
Promise<number>
Defined in
api/fitnessTracker/getStatisticTodayTotal.ts:8
getStatisticWeekDaily
▸ getStatisticWeekDaily(dataType): Promise<DailyData>
Gets statistic daily total for current week of given data type.
Parameters
| Name | Type |
|---|---|
dataType | FitnessDataType |
Returns
Promise<DailyData>
Defined in
api/fitnessTracker/getStatisticWeekDaily.ts:8
getStatisticWeekTotal
▸ getStatisticWeekTotal(dataType): Promise<number>
Gets statistic accumulated total for current week of given data type.
Parameters
| Name | Type |
|---|---|
dataType | FitnessDataType |
Returns
Promise<number>
Defined in
api/fitnessTracker/getStatisticWeekTotal.ts:8
queryDailyTotals
▸ queryDailyTotals(dataType, startDate, endDate): Promise<DailyData>
Gets statistic daily total for specified time period.
Parameters
| Name | Type | Description |
|---|---|---|
dataType | FitnessDataType | e.g. FitnessDataType.Steps |
startDate | number | Date | Unix timestamp or Date for record start date. |
endDate | number | Date | Unix timestamp or Date for record end date. |
Returns
Promise<DailyData>
Defined in
api/fitnessTracker/queryDailyTotals.ts:12
queryTotal
▸ queryTotal(dataType, startDate, endDate): Promise<number>
Gets statistic accumulated total for specified time period of given data type.
Parameters
| Name | Type | Description |
|---|---|---|
dataType | FitnessDataType | e.g. FitnessDataType.Steps |
startDate | number | Date | Unix timestamp or Date for record start date. |
endDate | number | Date | Unix timestamp or Date for record end date. |
Returns
Promise<number>