React Native Health Connect backend sync

React Native Health Connect backend sync requires an Android app to read permitted records and upload them. HC Sync adds that upload path, server storage, REST reads and signed webhooks. Mint one scoped user token per signed-in user on your backend. The integration is Android only and does not add Apple HealthKit.

Last updated: 2026-11-04. The wrapper backfills 30 days on first use. Source for the 2026 service details: HC Sync page details.

What do the two React Native packages do?

The native bridge handles Android Health Connect access. Our hcsync-react-native wrapper converts supported records and uploads them to HC Sync. Neither package gives your server direct access to a phone. The user must install your app, approve the requested permissions and have data available in Health Connect. This is Android only; it does not add Apple HealthKit or cloud wearable OAuth connections.

Follow the installation guide and full TypeScript source for the package archive and peer dependencies. You can inspect the source before adopting it. If you already use react-native-health-connect, keep your existing permission UI and review which parts of the wrapper fit your flow. Do not install an unrelated package just because it appears in an npm search for a Health Connect backend.

How do you mint tokens on your backend?

Run this request from your server, replacing maya with your own stable pseudonymous user id. Return only the resulting token to that authenticated user. Never embed the project secret in a JavaScript bundle, even if the bundle is minified.

curl -X POST https://hcsync.dev/v1/user-tokens \
  -H "authorization: Bearer $HCSYNC_SECRET" \
  -H "content-type: application/json" -d '{"user_id":"maya"}' 

How do you request permissions and sync?

Use the same selected record types throughout the permission and sync flow. Handle a false connection result as a user-visible unavailable or permission state. Do not treat it as an upload success.

import { connectHealth, syncHealthOnce, resetHealthSync } from "hcsync-react-native";
const types = ["Steps", "SleepSession"] as const;
// After your own explicit consent screen, from a user action:
if (await connectHealth(types)) {
  await syncHealthOnce(userToken, types); // token returned by your authenticated backend
}
// On logout:
await resetHealthSync(userToken);

Call syncHealthOnce when the app starts and returns to the foreground. The wrapper prevents overlapping calls and stores change positions per user token identity. It backfills 30 days on first use and then reads changes, including deletions. It does not promise continuous background execution; choose the native Android SDK if your integration needs its background scheduling.

How does your backend serve uploaded health data?

Once the phone uploads, your backend can call GET /v1/records for the same user_id or GET /v1/summary for daily totals. Keep the read key server-side whenever your application serves multiple users, and enforce your own authorization before returning health data to a browser. Prefer summary for a chart of daily steps; raw records include multiple sources and can overlap.

How do you verify the full integration?

Create a free project and save the secret key, read key, webhook secret and recovery code somewhere secure. The secret key belongs on your backend. A user token authorizes writes for one user; it is not a credential for reading records. Your own authenticated endpoint must select the user id from the signed-in session rather than accepting an arbitrary id from the app.

Start with sample data to test server reads without a phone. The sample user proves that your API credentials and parsing work; it does not prove Health Connect permissions or a device integration. Next test a real Android phone, grant only the permissions your feature uses, and confirm that a source app actually wrote those records into Health Connect. An empty response can mean no source data, denied permission, an incorrect user id or a time window that misses the records.

How should you handle consent, deletion and operations?

Before uploading health data, show a separate explicit consent choice with an unticked control, your purpose, the requested data types, US storage through HC Sync, and a way to withdraw. Android permission approval alone does not explain your server processing. Match your privacy notice and Play declarations to the actual types you collect. The consent and publishing checklist gives sample copy to adapt.

Keep your own downstream storage consistent with deletion events. Deleting a user with the secret-key API removes their server records and revokes existing device tokens. Stop local sync on withdrawal as well. Reads expose current records, not a permanent history of deletions. Webhook delivery can fail, so monitor attempts in the dashboard, retain event ids for deduplication, and handle retries without duplicating side effects. The API documentation describes queue limits and replay.

What are the common integration questions?

Does React Native need a backend?

Local Health Connect reads do not. HC Sync adds server storage, REST reads and webhooks when your feature needs them.

Does it work with Expo?

Use an Android development build with the native dependencies and explicit plugin types. Expo Go cannot load the native Health Connect module.

React Native Health Connect backend · Expo Health Connect · Health Connect Python · Health Connect REST API

Create a free project

How do I delete a user’s data?

DELETE /v1/users/{id} removes everything for that user immediately.