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

quarvis-device-sdk-react-native

v1.0.12

Published

Quarvis Health device SDK for React Native

Readme

quarvis-device-sdk-react-native

Quarvis Health device SDK for React Native

Installation

npm install quarvis-device-sdk-react-native
cd ios && pod install

Add the following to your ios/Your-App/Info.plist:


<plist version="1.0">
  <dict>
    <!--    ... rest of your properties-->
    <dict>
      <!-- Do not change NSAllowsArbitraryLoads to true, or you will risk app rejection! -->
      <key>NSAllowsArbitraryLoads</key>
      <false/>
      <key>NSAllowsLocalNetworking</key>
      <true/>
    </dict>
    <key>NSLocationWhenInUseUsageDescription</key>
    <string>We need location access to use Bluetooth for connecting to devices.</string>
    <key>NSBluetoothAlwaysUsageDescription</key>
    <string>We use Bluetooth to connect to nearby devices for enhanced functionality.</string>
    <key>NSBluetoothPeripheralUsageDescription</key>
    <string>Bluetooth access is required to communicate with nearby devices.</string>
    <key>UIBackgroundModes</key>
    <array>
      <string>bluetooth-central</string>
      <string>bluetooth-peripheral</string>
    </array>
  </dict>
</plist>

Add the following to your android/app/proguard-rules.pro:

  -keep class com.crrepa.ble.** { *; }

Add the following to your android/app/src/main/AndroidManifest.xml


<manifest xmlns:android="http://schemas.android.com/apk/res/android"
          package="com.yourapp">
  <!-- ... -->
  <uses-permission android:name="android.permission.BLUETOOTH"/>
  <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
  <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
  <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
  <uses-permission android:name="android.permission.INTERNET"/>
  <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
  <!-- Android 12 specific permissions -->
  <uses-permission android:name="android.permission.BLUETOOTH_SCAN"/>
  <uses-permission android:name="android.permission.BLUETOOTH_CONNECT"/>
</manifest>

Usage

You can check the usage of the SDK in the example folder.

import { isBluetoothEnabled } from 'quarvis-device-sdk-react-native';

// ...

const result = await isBluetoothEnabled();

Background synchronization

If you need a background synchronization, you can use the following package. Please, follow installation instructions from the package documentation.

Check the background synchronization in the example folder.

const initBackgroundFetch = useCallback(async () => {
  const onEvent = async (taskId: string) => {
    console.log('[BackgroundFetch] Received task: ', taskId);
    try {
      onGetTodayActivity();
      const [sleepInfo, heartRateInfo, bloodOxInfo, stressInfo] =
        await Promise.allSettled([
          onGetSleepInfo(),
          onGetHeartRate(),
          onGetBloodOx(),
          onGetStressInfo(),
        ]);
      console.log('[BackgroundFetch] Received sync data:', {
        sleepInfo: 'value' in sleepInfo ? sleepInfo?.value : null,
        heartRateInfo:
          'value' in heartRateInfo ? heartRateInfo?.value : null,
        bloodOxInfo: 'value' in bloodOxInfo ? bloodOxInfo?.value : null,
        stressInfo: 'value' in stressInfo ? stressInfo?.value : null,
        receivedSteps,
      });
    } catch (error) {
      console.error('[BackgroundFetch] Error in background sync:', error);
    } finally {
      BackgroundFetch.finish(taskId);
    }
  };
  const onTimeout = async (taskId: string) => {
    console.warn('[BackgroundFetch] TIMEOUT task: ', taskId);
    BackgroundFetch.finish(taskId);
  };

  const status = await BackgroundFetch.configure(
    {
      minimumFetchInterval: 15,
      stopOnTerminate: true,
      enableHeadless: false,
      startOnBoot: false,
      forceAlarmManager: false,
      requiredNetworkType: BackgroundFetch.NETWORK_TYPE_ANY,
    },
    onEvent,
    onTimeout
  );
  console.log('[BackgroundFetch] configure status: ', status);
}, [
  onGetBloodOx,
  onGetHeartRate,
  onGetSleepInfo,
  onGetStressInfo,
  onGetTodayActivity,
  receivedSteps,
]);

useEffect(() => {
  initBackgroundFetch();
}, [initBackgroundFetch]);

Jest integration

Using QuarvisDeviceSdkReactNative in Jest tests requires mocking the native modules. You can use the following steps to mock the SDK in Jest tests.

With mocks directory

  1. In your project root directory, create __mocks__/quarvis-device-sdk-react-native directory.
  2. Inside that folder, create index.ts file.
  3. Inside that file, export quarvis-device-sdk-react-native/jest mock.
export * from 'quarvis-device-sdk-react-native/jest';

With Jest setup file

  1. In your Jest config (probably in package.json) add setup files location:
{
  "jest": {
    "setupFiles": [
      "./path/to/jestSetupFile.js"
    ]
  }
}
  1. Inside your setup file, set up quarvis-device-sdk-react-nativ mocking:
jest.mock('quarvis-device-sdk-react-native', () =>
  require('quarvis-device-sdk-react-native/jest')
);

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT


Made with create-react-native-library