Overview
react-native-fitness is a library that enables interaction with Apple Healthkit and Google Fit on both iOS and Android platforms. It provides APIs to read steps count or distance count for a specified time period. The library is open for contributions in the form of new features or enhancements.
Features
- Cross-Platform Compatibility: Works on both iOS and Android.
- Access Apple Healthkit and Google Fit: Interact with health data from both platforms.
- API for Fitness Data: Provides APIs to retrieve steps count and distance count.
Installation
Getting started
npm install @ovalmoney/react-native-fitness --saveor
yarn add @ovalmoney/react-native-fitnessAutomatic installation for iOS
- Add to Podfile:
pod 'libreact-native-fitness.a' - Run
pod installin iOS project directory. - In Xcode, select project, go to Build Phases ➜ Link Binary With Libraries, and add
libreact-native-fitness.a. - Add necessary permissions to
Info.plist.
- Add to Podfile:
Manual installation for iOS
- In Xcode, right click Libraries ➜ Add Files to your project ➜ Add RNFitness.xcodeproj.
- Go to Build Phases ➜ Link Binary With Libraries, add
libRNFitness.a. - Run the project.
- Turn on Health Kit in Capabilities.
Android Installation
- Obtain OAuth 2.0 Client ID.
- Add
RNFitnessPackageto MainApplication.java. - Include necessary lines in
android/settings.gradleandandroid/app/build.gradle.
Summary
react-native-fitness is a versatile library that allows developers to integrate fitness data from Apple Healthkit and Google Fit into their React Native applications. With clear installation guides and key features like cross-platform compatibility and access to fitness APIs, it provides a valuable tool for health and fitness app development. Developers can further contribute to the library by submitting new features or improvements through PRs.