sahha_flutter 1.3.9-beta.2 copy "sahha_flutter: ^1.3.9-beta.2" to clipboard
sahha_flutter: ^1.3.9-beta.2 copied to clipboard

Sahha Flutter Plugin

Sahha SDK for Flutter Apps #

The Sahha SDK provides a convenient way for Flutter apps to connect to the Sahha API.

Sahha lets your project seamlessly collect health and lifestyle data from smartphones and wearables via Apple Health, Google Health Connect, and a variety of other sources.

For more information on Sahha please visit https://sahha.ai.


Docs #

The Sahha Docs provide detailed instructions for installation and usage of the Sahha SDK.

Sahha Docs


Example #

The Sahha Demo App provides a convenient way to try the features of the Sahha SDK.

Sahha Demo App


Health Data Source Integrations #

Sahha supports integration with the following health data sources:

& many more! Please visit our integrations page for more information.


Install #

In the pubspec.yaml file, add the Sahha sdk to dependencies.

dependencies:
  # Sahha
  sahha_flutter: ^1.1.4

Android #

On Android, sensor data is collected via Google Health Connect. In the AndroidManifest.xml file, which can be found in android > app > src > main, declare the Health Connect data types your project needs.

Important: enableSensors() and getSensorStatus() will only ever prompt for permissions you have declared here. Any sensor you pass that does not have a matching <uses-permission> entry is silently ignored on Android — so if a permission isn't appearing in the Health Connect prompt, it's almost always missing from the manifest.

The full set of supported Health Connect read permissions is shown below. Only include the ones your project actually needs.

<!-- Sleep -->
<uses-permission android:name="android.permission.health.READ_SLEEP" />

<!-- Activity -->
<uses-permission android:name="android.permission.health.READ_STEPS" />
<uses-permission android:name="android.permission.health.READ_FLOORS_CLIMBED" />
<uses-permission android:name="android.permission.health.READ_EXERCISE" />

<!-- Heart -->
<uses-permission android:name="android.permission.health.READ_HEART_RATE" />
<uses-permission android:name="android.permission.health.READ_RESTING_HEART_RATE" />
<uses-permission android:name="android.permission.health.READ_HEART_RATE_VARIABILITY" />

<!-- Energy -->
<uses-permission android:name="android.permission.health.READ_ACTIVE_CALORIES_BURNED" />
<uses-permission android:name="android.permission.health.READ_TOTAL_CALORIES_BURNED" />
<uses-permission android:name="android.permission.health.READ_BASAL_METABOLIC_RATE" />

<!-- Oxygen -->
<uses-permission android:name="android.permission.health.READ_VO2_MAX" />
<uses-permission android:name="android.permission.health.READ_OXYGEN_SATURATION" />
<uses-permission android:name="android.permission.health.READ_RESPIRATORY_RATE" />

<!-- Blood -->
<uses-permission android:name="android.permission.health.READ_BLOOD_GLUCOSE" />
<uses-permission android:name="android.permission.health.READ_BLOOD_PRESSURE" />

<!-- Body -->
<uses-permission android:name="android.permission.health.READ_HEIGHT" />
<uses-permission android:name="android.permission.health.READ_WEIGHT" />
<uses-permission android:name="android.permission.health.READ_LEAN_BODY_MASS" />
<uses-permission android:name="android.permission.health.READ_BODY_FAT" />
<uses-permission android:name="android.permission.health.READ_BODY_WATER_MASS" />
<uses-permission android:name="android.permission.health.READ_BONE_MASS" />

<!-- Temperature -->
<uses-permission android:name="android.permission.health.READ_BODY_TEMPERATURE" />
<uses-permission android:name="android.permission.health.READ_BASAL_BODY_TEMPERATURE" />

<!-- Nutrition (all *_intake sensors map to READ_NUTRITION; water_intake maps to READ_HYDRATION) -->
<uses-permission android:name="android.permission.health.READ_NUTRITION" />
<uses-permission android:name="android.permission.health.READ_HYDRATION" />

<!-- Reproductive -->
<uses-permission android:name="android.permission.health.READ_MENSTRUATION" />
<uses-permission android:name="android.permission.health.READ_INTERMENSTRUAL_BLEEDING" />
<uses-permission android:name="android.permission.health.READ_CERVICAL_MUCUS" />
<uses-permission android:name="android.permission.health.READ_OVULATION_TEST" />
<uses-permission android:name="android.permission.health.READ_SEXUAL_ACTIVITY" />

Declaring these permissions also lets you retrieve Health Connect data shared by other health apps such as WHOOP, Garmin, Samsung Health etc.

Note: not every SahhaSensor has a Health Connect equivalent. The symptom sensors, the demographic sensors (gender, date_of_birth), activity_summary, device_lock, and the iOS-only metrics (e.g. heart_rate_variability_sdnn, body_mass_index, waist_circumference, the walking/running gait sensors, pregnancy/contraceptive, etc.) have no Health Connect data type. They are safely ignored on Android and do not need a manifest entry. Several sensors also share one permission — for example all 39 nutrition sensors map to just READ_NUTRITION and READ_HYDRATION.

To declare other sensor permissions, please refer to this page.

Only include the sensor permissions required by your project, what is declared here will be reviewed by the Play Store.

You must be able to justify reasons behind requiring the sensor permissions, these justifications may be used to clearly articulate the reasoning behind your required sensor permissions.

Apple iOS #

Enable HealthKit

  • Open your project in Xcode and select your App Target in the Project panel.
  • Navigate to the Signing & Capabilities tab.
  • Click the + button (or choose Editor > Add Capability) to open the Capabilities library.
  • Locate and select HealthKit; double-click it to add it to your project.

Background Delivery

  • Select your project in the Project navigator and choose your app’s target.
  • In the Signing & Capabilities tab, find the HealthKit capability.
  • Enable the nested Background Delivery option to allow passive health data collection.

Add Usage Descriptions

  • Select your App Target and navigate to the Info tab.

  • Click the + button to add a new key and choose Privacy - Health Share Usage Description.

  • Provide a clear description, such as: "This app needs your health info to deliver mood predictions."

  • Also add Privacy - Motion Usage Description (NSMotionUsageDescription) key.

  • Provide a description, such as: "This app needs motion data to track your activity and provide health insights."

    Or add the Motion Usage Description directly in your Info.plist file:

    <key>NSMotionUsageDescription</key>
    <string>This app needs motion data to track your activity and provide health insights</string>
    

For more detailed instructions, refer to our setup guide.


API #


Copyright © 2022 - 2023 Sahha. All rights reserved.

1
likes
120
points
624
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Sahha Flutter Plugin

Homepage
Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

file, flutter

More

Packages that depend on sahha_flutter

Packages that implement sahha_flutter