Mobile SDK Installation
Learn about the minimum runtime and build-time requirements of Vital Mobile SDKs, and how to add them into
your project through your package dependency manager.
Vital Health SDK
Learn about the initial setup required by Vital Health SDK, and the API exposed by Vital Health SDK
for managing and inspecting health data permissions and automatic data sync.
Sync Frequency
App state | Behaviour |
---|---|
Foreground | Apple HealthKit delivers any buffered and new changes immediately. |
Background | Hourly batch delivery of changes, subject to operating system throttling. |
Getting Started
To enable this integration, you would need to integrate Vital Core SDK and Vital Health SDK into your Native iOS, React Native or Flutter mobile app.1
Add Vital SDKs as dependencies
2
Integrate with Vital Mobile SDK Authentication
Follow the SDK Authentication guidance to integrate your app with the authentication
mechanism of Vital Core SDK.
3
Configure Health SDK and ask user for read permissions
Follow the Vital Health SDK guidance to
configure your App Delegate,
configure the Health SDK and to
ask for health data read permissions from your user.
Health data sync is activated only on
VitalResource
s which you have asked permissions from your user for. If you
did not ask for permissions, data sync would not occur.4
Configure Background Delivery
Follow the Apple HealthKit Background Delivery guidance below to
setup your iOS app target as an eligible target for Apple HealthKit Background Delivery.
Setting up Apple HealthKit Background Delivery
You MUST configure your App Delegate for
Apple HealthKit Background Delivery to function as expected.
- Your app user does not open your app regularly;
- Your app user forces quit your app; or
- The iPhone has been restarted for any reason.
Enabling Apple HealthKit will attract additional scrutiny in the App Store Review process. You should be prepared
to explain and demonstrate your usage of these health and fitness data.
1. Setup app entitlements
Enable the “HealthKit > Background Delivery” entitlement:

2. Update your Info.plist
In your “Info > Custom iOS Target Properties” section — also known as theInfo.plist
file — these entries should be
configured:
Key | Value |
---|---|
Privacy - Health Share Usage Description ( NSHealthShareUsageDescription ) | An explanation of your usage of the user’s HealthKit data. |
Permitted background task scheduler identifiers ( BGTaskSchedulerPermittedIdentifiers ) | Include io.tryvital.VitalHealthKit.ProcessingTask in the array, alongside any other BGTask identifiers of yours. |
Key | Value |
---|---|
Privacy - Health Update Usage Description ( NSHealthUpdateUsageDescription ) | An explanation of what user health data your app is writing to Apple HealthKit. |
3. Epilogue
You are all set! Note that there is no need to callsyncData()
manually at all. Once you have asked the user for permission on
resources, sync would automatically starts every app launch, as well as whenever your app is woken up by Apple HealthKit to
respond to newly available data.
As per the documentation:
HealthKit wakes your app whenever a process saves or deletes samples of the specified type. The system wakes your app at most once per time period defined by the specified frequency. Some sample types have a maximum frequency ofThis means that although we have background delivery’s frequency set toHKUpdateFrequency.hourly
. The system enforces this frequency transparently. For example, on iOS,stepCount
samples have an hourly maximum frequency.
.hourly
, we cannot guarantee hourly syncing on the dot.