A React Native bridge module for interacting with Google Fit
A React Native bridge module for interacting with Google Fit
A React Native bridge module for interacting with Google Fit on Android.
⚠️ Important Notice: Google has deprecated the Google Fit API and is transitioning to Health Connect. While the Google Fit API remains available, we are committed to maintaining this library and bringing it up to the latest standards. We will continue to support this library as long as the API is accessible and will provide migration guidance when Health Connect integration becomes necessary.
# Expo
npx expo install react-native-google-fit
# React Native CLI
npm install react-native-google-fit --save
# or
yarn add react-native-google-fit→ Full installation instructions
import GoogleFit, { Scopes } from 'react-native-google-fit'
// 1. Authorize
const options = {
scopes: [
Scopes.FITNESS_ACTIVITY_READ,
Scopes.FITNESS_ACTIVITY_WRITE,
Scopes.FITNESS_BODY_READ,
Scopes.FITNESS_BODY_WRITE,
],
}
const authResult = await GoogleFit.authorize(options)
// 2. Get daily steps
const steps = await GoogleFit.getDailyStepCountSamples({
startDate: "2024-01-01T00:00:00.000Z",
endDate: new Date().toISOString()
})
// 3. Save weight
await GoogleFit.saveWeight({
value: 75.5,
date: new Date().toISOString(),
unit: "kg"
})Check out the example app repository for a complete working example.
Track steps, distance, move minutes, and calories burned.
Record and retrieve weight and height data.
Monitor cardiovascular health metrics.
Track blood glucose, body temperature, and oxygen saturation.
Log food intake and water consumption.
Record sleep sessions with stages (light, deep, REM).
Save and retrieve workout sessions with activity types.
Contributions are welcome! Please:
git checkout -b feature/amazing-feature)git commit -m 'feat: add amazing feature')git push origin feature/amazing-feature)See CONTRIBUTING.md for details.
"Authorization Failed"
"Google Play Services not available"
MIT © StasDoskalenko
Thanks to all contributors who have helped make this library better!
No open issues yet, or sync has not completed.