Sleep Detector is a React Native Expo app that automatically tracks your sleep patterns based on phone usage.
- Automatic Sleep Detection: The app detects when you're asleep based on phone inactivity
- Sleep Statistics: View detailed statistics about your sleep patterns
- Sleep History: Browse your sleep history with daily summaries
- Data Export: Export your sleep data in JSON or CSV format
- Customizable Settings: Adjust the inactivity threshold to match your habits
The app monitors your phone usage to determine when you're awake or asleep:
- When you use your phone, the app considers you awake
- When your phone remains inactive for a set period (default: 45 minutes), the app considers you asleep
- The app records these state changes to build a picture of your sleep patterns
- Node.js (v14 or newer)
- npm
- Expo CLI
- iOS or Android device/emulator
- Clone the repository:
git clone https://github.com/pH-7/detect-sleep.git
cd detect-sleep
- Install dependencies:
npm install
- Start the Expo development server:
npx expo start
- Open the app on your device using the Expo Go app or run it in an emulator.
The Today screen shows your current sleep status and a timeline of your activity for the day. You can see at a glance how much sleep you've gotten so far today.
Browse through your sleep history day by day. See when you fell asleep and woke up, and how much total sleep you got each day.
View statistics about your sleep patterns, including:
- Average sleep duration
- Sleep consistency
- Sleep quality metrics
- Visual charts of your sleep patterns
Customize the app to match your habits:
- Adjust the inactivity threshold (how long before the app considers you asleep)
- Enable/disable notifications
- Manage your data
- Test on iOS simulator:
npm run ios
- Test on Android emulator:
npm run android
- Test on your physical device by scanning the QR code from the Expo Go app after running:
npx expo start
- Install EAS CLI:
npm install -g eas-cli
- Log in to your Expo account:
eas login
- Configure EAS Build:
eas build:configure
Create or update eas.json
:
{
"cli": {
"version": ">= 5.9.1"
},
"build": {
"development": {
"developmentClient": true,
"distribution": "internal"
},
"preview": {
"distribution": "internal",
"ios": {
"simulator": true
}
},
"production": {
"ios": {
"resourceClass": "m-medium"
}
}
},
"submit": {
"production": {
"ios": {
"appleId": "[email protected]",
"ascAppId": "1234567890",
"appleTeamId": "ABCDEFGHIJ"
}
}
}
}
- Update version in
app.json
:
{
"expo": {
"version": "1.0.0",
"ios": {
"buildNumber": "1",
"bundleIdentifier": "com.yourcompany.sleepdetector"
}
}
}
- Create production build:
eas build --platform ios --profile production
- Submit the build:
eas submit --platform ios --profile production
- Complete App Store Connect information:
- App metadata
- Privacy policy URL
- Support URL
- Screenshots
- App Review Information
Update eas.json
:
{
"build": {
"production": {
"android": {
"buildType": "app-bundle"
}
}
},
"submit": {
"production": {
"android": {
"serviceAccountKeyPath": "./path/to/service-account.json",
"track": "production"
}
}
}
}
- Update version in
app.json
:
{
"expo": {
"version": "1.0.0",
"android": {
"versionCode": 1,
"package": "me.ph7.sleepdetector"
}
}
}
- Create production build:
eas build --platform android --profile production
- Submit the build:
eas submit --platform android --profile production
- Complete Play Store listing:
- Store listing
- Content rating
- Pricing & distribution
- App releases
- App Icon: 1024x1024px
- Screenshots:
- iPhone 6.5" Display: 1242x2688px
- iPhone 5.5" Display: 1242x2208px
- iPad Pro 12.9": 2048x2732px
- App Icon: 512x512px
- Feature Graphic: 1024x500px
- Screenshots:
- Phone: 1080x1920px
- 7-inch Tablet: 1200x1920px
- 10-inch Tablet: 1920x2560px
- Build Fails:
# Clear build cache
eas build:clear
# Try building again
eas build --platform ios --profile production
- Submission Fails:
# Check build status
eas build:list
# View submission logs
eas submit --platform ios --profile production --verbose
Pierre-Henry Soria — a super passionate engineer who loves automating content creation efficiently!
Enthusiast of YouTube, AI, learning, and writing performant code! ⚡️ Find me at pH7.me
Enjoying this project? Buy me a coffee (spoiler: I love almond extra-hot flat white coffees).
Your sleep data is always stored locally on your device. The app does not send your data to any servers unless you explicitly use the export feature to share it.
Sleep Detector is generously distributed under the MIT License.