npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

new-react-native-samsung-health

v1.0.0

Published

React Native bridge for Samsung Health — read steps, step history, and exercise data on Android

Readme

react-native-samsung-health

React Native bridge for Samsung Health (Android only). Read steps, step history, and exercise data.


Requirements

  • React Native ≥ 0.60
  • Android only (Samsung device with Samsung Health app installed)
  • Android minSdk ≥ 29 (Android 10)

Installation

npm install react-native-samsung-health

Then rebuild your Android app:

npx react-native run-android

Auto-linking handles everything else — no need to touch MainApplication.kt.


Android Setup

Two things to configure in your project (everything else is handled by the plugin automatically).

1. Disable New Architecture

This package uses the Old Bridge architecture and is not compatible with TurboModules. Add this to android/gradle.properties:

newArchEnabled=false

2. minSdkVersion

The Samsung Health SDK requires Android 10 minimum. Make sure your android/build.gradle has:

// android/build.gradle
ext {
    minSdkVersion = 29  // required by Samsung Health SDK
    // ...
}

That's it

Everything below is handled automatically by the plugin — no action required:

| What | How | |---|---| | ACTIVITY_RECOGNITION permission | Auto-merged from plugin's AndroidManifest.xml | | <queries> for Samsung Health package | Auto-merged from plugin's AndroidManifest.xml | | Samsung Health SDK (AAR) | Bundled inside the plugin | | kotlin-parcelize-runtime | Declared as plugin dependency | | gson | Declared as plugin dependency | | Module registration | Auto-linking (RN ≥ 0.60) |


Usage

Hook

import { useSamsungHealth } from 'react-native-samsung-health';

function MyScreen() {
  const { isConnected, isLoading, login, logout, getSteps, getActivities, checkConnection } = useSamsungHealth();

  const handleConnect = async () => {
    const connected = await login();
    console.log('Connected:', connected);
  };

  const handleSteps = async () => {
    const history = await getSteps();
    // [{ date: "2026-03-28", value: 8432 }, ...]
    console.log(history);
  };

  const handleActivities = async () => {
    const activities = await getActivities();
    // [{ startTime: "...", endTime: "...", type: "RUNNING", distance: "5200.0", duration: "1800000" }, ...]
    console.log(activities);
  };

  return (
    // ...
  );
}

Direct native module access

For advanced use cases you can call the native module directly:

import { SamsungHealthModule } from 'react-native-samsung-health';

// Check if Samsung Health app is installed
const installed = await SamsungHealthModule.isSamsungHealthInstalled();

// Initialize the store
await SamsungHealthModule.initialize();

// Request permissions (shows Samsung Health permission dialog)
await SamsungHealthModule.requestPermissions();

// Check which permissions are granted
const status = await SamsungHealthModule.checkConnection();
// { steps: true, exercise: true, connected: true }

// Read today's total steps
const steps = await SamsungHealthModule.readStepCount();

// Read 14-day step history
const history = await SamsungHealthModule.readStepHistory();
// [{ date: "2026-03-28", value: 8432 }, ...]

// Read 3-week exercise history
const exercises = await SamsungHealthModule.readExercises();
// [{ startTime, endTime, type, distance, duration }, ...]

API Reference

useSamsungHealth()

| Property | Type | Description | |---|---|---| | isConnected | boolean | Whether permissions are currently granted | | isLoading | boolean | True during initialization or permission request | | login() | Promise<boolean> | Initialize + request permissions. Returns true if granted | | logout() | Promise<void> | Clear local connection state | | getSteps() | Promise<StepHistoryEntry[]> | 14-day step history | | getActivities() | Promise<ExerciseEntry[]> | 3-week exercise history | | checkConnection() | Promise<ConnectionStatus> | Check current permission status without showing any dialog |

Types

interface StepHistoryEntry {
  date: string;   // "YYYY-MM-DD"
  value: number;  // total steps for the day
}

interface ExerciseEntry {
  startTime: string;  // ISO datetime
  endTime: string;    // ISO datetime
  type: string;       // e.g. "WALKING", "RUNNING", "CYCLING"
  distance: string;   // in meters
  duration: string;   // in milliseconds
}

interface ConnectionStatus {
  steps: boolean;
  exercise: boolean;
  connected: boolean;
}

Troubleshooting

App crashes silently when calling step or exercise methods

Rebuild from scratch after installing:

cd android && ./gradlew clean && cd ..
npx react-native run-android

TurboModuleRegistry.getEnforcing error at startup

The new architecture is enabled. Set newArchEnabled=false in android/gradle.properties and do a clean rebuild.

isSamsungHealthInstalled() always returns false

Either Samsung Health is not installed on the device, or the <queries> block is missing from the merged manifest. Check:

android/app/build/intermediates/merged_manifests/debug/AndroidManifest.xml

Samsung Health permission dialog doesn't appear

initialize() must be called before requestPermissions(). The login() hook method handles this automatically.

Build fails with minSdkVersion error

Set minSdkVersion = 29 in the ext block of android/build.gradle.

Steps always return 0 / exercises return empty

This is expected on an emulator — Samsung Health has no data. Test on a real Samsung device with Samsung Health installed and some recorded activity.