React Native

React Native library for integrating WeFitter and Samsung Health into your app

  • This library is written with Native Modules for React Native CLI. Expo Go is unsupported


yarn add


Add wefitter-shealth-2.0.2.aar and samsung-health-data-1.5.0.aar to libs folder which should normally be in app/libs. These files can be found in node_modules/react-native-wefitter-samsung/android/libs in your protect or here. Make sure you select the same version tag you are using in your app before downloading to prevent incompatibility issues.



Add the following code:

See the example app for the full source.

Show code example
Hide code example
import WeFitterSamsung, {
} from 'react-native-wefitter-samsung';

// ...

const [connected, setConnected] = useState<boolean>(false);

useEffect(() => {
  if (Platform.OS === 'android') {
    // create native event emitter and event listeners to handle status updates
    const emitter = new NativeEventEmitter();
    const configuredListener = emitter.addListener(
      (event: ConfiguredEvent) =>
        console.log(`WeFitterSamsung configured: ${event.configured}`)
    const connectedListener = emitter.addListener(
      (event: ConnectedEvent) => {
        console.log(`WeFitterSamsung connected: ${event.connected}`);
    const errorListener = emitter.addListener(
      (event: ErrorEvent) => {
        console.log(`WeFitterSamsung error: ${event.error}`);

        // `error` can be checked to override specific messages
        // `forUser` boolean indicates the error requires user interaction
        if (event.forUser) {
          Alert.alert('', event.error, [
              text: 'OK',
              onPress: () => {
                // `tryToResolveError` will guide the user on fixing certain errors
                // for example:
                // - link to the app store to install or update Samsung Health
                // - open Samsung Health to accept privacy policy
                // - open Settings when Samsung Health needs to be enabled

    // create config
    const config = {
      token: 'YOUR_TOKEN', // required
      apiUrl: 'YOUR_API_URL', // required, the url should be base without `v1/ingest/` as the library will append this. For example: ``
      startDate: 'CUSTOM_START_DATE', // optional with format `yyyy-MM-dd`, by default data of the past 20 days will be uploaded
      notificationTitle: 'CUSTOM_TITLE', // optional
      notificationText: 'CUSTOM_TEXT', // optional
      notificationIcon: 'CUSTOM_ICON', // optional, e.g. `ic_notification` placed in either drawable, mipmap or raw
      notificationChannelId: 'CUSTOM_CHANNEL_ID', // optional
      notificationChannelName: 'CUSTOM_CHANNEL_NAME', // optional

    // configure WeFitterSamsung

    return () => {
}, []);

const onPressConnectOrDisconnect = () => {
  if (Platform.OS === 'android') {
    connected ? WeFitterSamsung.disconnect() : WeFitterSamsung.connect();
  } else {
    Alert.alert('Not supported', 'WeFitterSamsung is not supported on iOS');

Thank you for reaching out!

We will be in touch with you soon. WeFitter team.

You are subscribed!

You will soon receive our newsletter!
WeFitter team.