terra-mobile-sdk

Integrate the Terra API mobile SDK for Apple Health, Samsung Health, and Health Connect.

Updated Sep 2, 2026
One-click install
npx skills add https://github.com/tryterra/agent-skills --skill terra-mobile-sdk-tryterra
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: terra-mobile-sdk
Source: https://github.com/tryterra/agent-skills/tree/main/skills/terra-mobile-sdk
Command: npx skills add https://github.com/tryterra/agent-skills --skill terra-mobile-sdk-tryterra

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Connecting health data sources that have no web API (Apple Health, Samsung Health, Health Connect) requires on-device SDK integration with platform-specific setup, permission handling, and background delivery that is easy to get wrong. ## Core Features & Use Cases - Six-step integration workflow: Covers install, initialization, backend token minting, initConnection, getUserId validation, and iOS background delivery across iOS, Android, React Native, and Flutter. - Platform-specific references: Per-platform setup detail for TerraiOS (Swift), TerraAndroid (Kotlin), terra-react, and terra_flutter_bridge, including capabilities, manifest entries, ProGuard rules, and code snippets. - Gotcha prevention: Documents permission-popup behavior, Samsung partnership requirements, Health Connect Google approval, user_reauth webhook handling, and setIgnoredSources limitations. - Use Case: You are building a React Native fitness app that reads Apple Health data. Use this Skill to set up initTerra, mint the auth token from your backend, handle the one-time permission popup, and enable background delivery in the AppDelegate. ## Quick Start Ask your AI agent to integrate the Terra mobile SDK into your iOS or Android app so it can read Apple Health, Samsung Health, or Health Connect data.

Frequently Asked Questions about terra-mobile-sdk

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I connect Apple Health to my app with the Terra API?

Install the TerraiOS SDK, add HealthKit capabilities and info.plist keys, initialize with Terra.instance, mint a single-use auth token from your backend, then call initConnection with type APPLE_HEALTH. Validate the connection with getUserId and enable background delivery via setUpBackgroundDelivery in the AppDelegate.

When should I use the Terra mobile SDK instead of the Unified API?

Use the mobile SDK only for Apple Health, Samsung Health, and Health Connect, which have no web API. Every other provider, including Garmin, Fitbit, Oura, Whoop, and Strava, connects through the Unified API, and Google Fit is better read via the web API for reliability.

Does the Terra mobile SDK support React Native and Flutter?

Yes, terra-react supports React Native and terra_flutter_bridge supports Flutter, both covering Apple Health, Samsung Health, and Health Connect. Each requires native iOS and Android setup such as pod install, HealthKit capabilities, minSDK 28, and manifest intent-filters.

Why does the HealthKit or Health Connect permission popup not appear again?

The OS permission popup fires only once on Apple Health and Health Connect, so calling initConnection again is a no-op. It re-triggers only if you expand customPermissions, the app is reinstalled, or on Health Connect you request a permission Google has not approved.

Why does my Samsung Health release build crash with the Terra SDK?

Release builds crash because R8 strips the Samsung classes during minification. Add the ProGuard rule -keep class com.samsung.android.** { *; } to proguard-rules.pro, and ensure you have an approved Samsung partnership and Developer Mode enabled on test devices.

What happens when a user reinstalls the app or switches devices?

A new device or reinstall with a reset vendor identifier causes Terra API to issue a new user_id, delete the previous connection, and send a user_reauth webhook with old_user and new_user. Handle it by migrating stored data from old_user.user_id to new_user.user_id.