Skip to main content

Setting up Apple HealthKit in your Cogniss app

HealthKit serves as a central repository for health data collected by iOS devices, enabling seamless integration with Cogniss-powered apps

Raymond Gerardino avatar
Written by Raymond Gerardino
Updated over 8 months ago

This feature is available on Cogniss Community. If you wish to enable it in your standalone environment, please get in touch with the Cogniss team.

Only available on apps launched on iOS devices.

Introduction

The Cogniss platform has integrated the beta version of HealthKit application into its suite of apps, bridging the gap between the health data ecosystem and the Cogniss platform. This integration empowers app creators to select and utilize relevant health data for their apps, transforming raw data into valuable insights and functionality.

Health data sync process during onboarding

Use case

Leveraging HealthKit enables you to generate progress charts utilizing your users' pre-existing Apple Health data. This integration allows for a seamless extraction of health metrics, such as activity levels, heart rate, and sleep patterns, providing a comprehensive overview of users' wellness journeys over time. By visualizing this data through progress charts, app creators gain valuable insights into users' health trends and behaviors, fostering a more personalized and impactful user experience

To learn more about the progress charts, read the Progress Charts article (coming soon)


How to set it up

Setting the HealthKit sync has two steps, enabling the use of HealthKit, and then prompting your app users to authorize their data sync.

The first part is enabling the use of HealthKit via Creator. App creators will also be able to select which data category they wish to apply for their app to collect (eg. sleep data or active data) from the Health app. It's important to note that, at this stage, this feature is available exclusively for iOS users.

Step 1. How to enable HealthKit via Creator

  1. Go to Creator, Settings tab, and locate the Health data settings (mobile only) under the Footer sub-menu

  2. Enable Apple Health Kit

    Once enabled, additional configuration options will become available, allowing you to specify the health data you want to extract from your users

  3. To select which health data you wish your app to collect, click the Select Data button and select from the choices of data.

    List of available health data can be found at the end of this article

  4. Click Done after selecting and Save changes to the Settings page.

Step 2. How to prompt your app users to authorize data sync

The second part is the user-facing experience within the mobile app. App users will be guided throughout the process of granting data permissions.

Please be aware that this can only be prompted once, specifically during the users onboarding journey in your app

  1. Navigate to Settings > Health Data Settings and customize the permission screen by crafting a succinct message that prompts users to grant permission for the app to access their data

    Tip: To encourage users to sync their health data, it's important to craft a message that communicates the value of the use of their data and ensures transparency

  2. Save changes to the Creator>Settings page. You can go back and reconfigure this later.

  3. Next, we need to use Behaviors to prompt this page during onboarding for new users.

    Go to the Behaviors tab and create a new behavior

    Trigger:
    Type: REQUEST

    Model: AppUser

    Operation: UPDATE


    Results:
    Result: Notification

    Type: SYSTEM_MESSAGE

    Message type: get_health_permission

  4. Enable the Open boolean, then hit Save changes when done.

    Upon enabling HealthKit integration and aligning it with user behavior, your app should prompt users to synchronize their data during their onboarding process.


List of current health data available

During this beta stage, the following health data are available for collection.

Health data

Details

Activity

Active Energy Burned

  • Minimum sync: Once per hour

  • Records total energy consumed per hour and day

  • Unit: kJ

Basal Energy Burned

  • Minimum sync: Once per hour

  • Records total energy consumed per hour and day

  • Unit: kJ

Body

Latest Weight

  • Records the sample weight

  • In case of multiple sample data, it will record the average weight for that hour and the average weight for that day

  • Unit: kg, lbs

Dietary

Water

  • Records the sample water intake

  • In case of multiple sample data, it will record the total water intake for that hour and the total water intake for that day

  • Unit: mL, L, fl oz

Fitness

Step Count

  • Records total steps per hour and day

  • Unit: steps

Distance Walking Running

  • Records total distance per hour and day

  • Unit: km, mi

Distance Swimming

  • Records total distance per hour and day

  • Unit: m, yd

Distance Cycling

  • Records total distance per hour and day

  • Unit: km, mi

Flight Climbed

  • Records total flights climbed per hour and day

  • Unit: floors

Sleep

Sleep Samples

  • Minimum sync every 4 hours

  • Upon each data sync, up to 6 data samples will be retained. In instances where there are more than 6 samples, it will store the longest 6 samples.

  • Unit: hours and minutes

Vitals

Heart Rate Samples

  • Records average heart rate per hour and day

  • Unit: BPM

Heart Rate Variability Samples

  • Records average heart rate variability per hour and day

  • Unit: ms

Resting Heart Rate Samples

  • Records average heart rate per hour and day

  • Unit: BPM

Walking Heart Rate Average

  • Records average heart rate per hour and day

  • Unit: BPM

Workout

Workout

  • Records per hour and day

  • In case of multiple sample data, retain the three longest sessions per hour and five longest sessions per day

  • Unit: minutes

General Sync Rules

  1. The app will initiate a sync process every 15 minutes

  2. Cogniss apps will only sync data from the previous 7 days


FAQ

Where are users' collected health data stored?

Once users sync their data, they are stored within Cogniss Insights.

To access the raw health data for each user, navigate to your app within Insights > select the Users tab > choose the desired user > navigate to the Health Data tab to find the data.

(Ensure that Health data is enabled in your app's Creator>Settings)
​

Did this answer your question?