Skip to main content

Extra: Calories events

Upload and display current day calories.

Introduction​

Calories events not only send current day calories count but also return the data that was sent, you can use this data to update your UI without waiting for the webhook event.

Getting started​

Ios configuration​

Go to the main Ios configuration section to see the basic configuration.

Logging​

Go to the main Logging section to configure logs.

Usage​

Initialize​

Go to the main Initialize and Update userID sections to initialize.

Permissions​

To use Calories events you will need:

info

In order to generate an event you need at least one of the following permissions Active energy, Resting energy.

Send calories events​

Retrieve and upload current day calories count of Apple Health.

void syncCaloriesEvents() async {
try {
final calories = await AHRookSyncManager.getTodayCaloriesCount();

if (calories != null) {
// Update the UI with calories count
} else {
// No calories events found
}
} catch (error) {
// Handle error
}
}