Permissions
ensurePermissions requests what is missing and re-checks. Typed Permission.* constants, no string typos.
A typed TurboModule for Android Health Connect: permissions, 42 record types, aggregates, changelog sync, and polling that survives the "0 steps on resume" problem.
yarn add @solutionforest/android-health-connect
npm install @solutionforest/android-health-connect
@solutionforest:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=YOUR_GITHUB_PAT
const { value, satisfied } = useForegroundPoll(
() => readSteps({
timeRangeFilter: timeRangeToday(),
}),
{
ready: (r) => r.records.length > 0,
timeoutMs: 15_000,
},
);
One package covers the whole Jetpack SDK surface, with TypeScript types that mirror Health Connect records one-to-one.
ensurePermissions requests what is missing and re-checks. Typed Permission.* constants, no string typos.
All 42 record types with a readSteps-style helper each, plus generic readRecords with paging.
aggregateRecord, Instant buckets by duration, calendar buckets by period.
getChangesToken → pullChanges drains upserts and deletes for incremental sync.
useForegroundPoll re-reads on every foreground until the data arrives, without fake zeros.
Feature-gated Matchmaking, planned exercise, and FHIR medical records behind getFeatureStatus.
Samsung Health, Fitbit, and Google Fit sync in the background. When your
app comes to the foreground, the first read usually returns before they
finish. The polling helpers keep trying until ready passes,
then report whether the result is real.
satisfied: false means the timeout hit, so it may be a real zeropollOnForeground, pollUntil, waitUntilimport {
readSteps,
timeRangeToday,
useForegroundPoll,
} from '@solutionforest/android-health-connect';
export function TodaySteps() {
const { value, satisfied, loading } = useForegroundPoll(
() => readSteps({ timeRangeFilter: timeRangeToday() }),
{
ready: (r) => r.records.length > 0,
timeoutMs: 15_000,
},
);
// satisfied === false → timed out; may be a real 0
}
Every release goes to npmjs.org with provenance and is mirrored to GitHub Packages. Pick whichever your org already uses.
Published by GitHub Actions through OIDC Trusted Publishing.
yarn add @solutionforest/android-health-connect
Scope the registry, then use a classic PAT with read:packages.
@solutionforest:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=YOUR_GITHUB_PAT
The package ships skills.md, an agent skill with the
version lines, hard constraints, and the right call order. Install it in
your app repo and Cursor, Claude Code, or Codex will follow it instead
of guessing APIs.
Run in your app root after installing the package. Commit the folder so the whole team gets it.
mkdir -p .cursor/skills/android-health-connect
cp node_modules/@solutionforest/android-health-connect/skills.md \
.cursor/skills/android-health-connect/SKILL.md
mkdir -p .claude/skills/android-health-connect
cp node_modules/@solutionforest/android-health-connect/skills.md \
.claude/skills/android-health-connect/SKILL.md
mkdir -p .agents/skills/android-health-connect
cp node_modules/@solutionforest/android-health-connect/skills.md \
.agents/skills/android-health-connect/SKILL.md
| Cursor | .cursor/skills/android-health-connect/SKILL.md |
| Claude Code | .claude/skills/android-health-connect/SKILL.md |
| Codex, others | .agents/skills/android-health-connect/SKILL.md |
Works before the package is installed. The agent downloads the latest skill from this site.
Install the android-health-connect agent skill: download https://solutionforest.github.io/AndroidHealthConnect/skills.md and save it as SKILL.md in this project's skills folder (.cursor/skills/android-health-connect/ for Cursor, .claude/skills/android-health-connect/ for Claude Code, otherwise .agents/skills/android-health-connect/). Then follow it whenever you work with @solutionforest/android-health-connect.
curl -fsSL --create-dirs \
-o .cursor/skills/android-health-connect/SKILL.md \
https://solutionforest.github.io/AndroidHealthConnect/skills.md
Availability, permissions, first read, and resume polling in four steps.