A comprehensive health and fitness tracking application for Wear OS (Galaxy Watch) with companion phone app support. Built with Flutter and integrated with Samsung Health Sensor SDK.
flutter run -d adb-RFAX21TD0NA-FFYRNh._adb-tls-connect._tcp -t lib/main_wear.dart flutter run -d 6ece264d -t lib/main.dart
π Project recently reorganized! All documentation is now in
docs/and scripts inscripts/. See docs/INDEX.md for complete documentation index.
FlowFit is a dual-platform fitness app that runs on:
- Galaxy Watch (Wear OS) - Primary device for real-time health tracking
- Android Phone - Companion app for data visualization and management
- β Real-time Heart Rate Monitoring - Continuous HR tracking with Samsung Health Sensor SDK
- β Inter-Beat Interval (IBI) Data - Advanced HRV analysis
- β Activity Tracking - Workout logging and exercise monitoring
- β Sleep Tracking - Sleep mode with sensor integration
- β Nutrition Logging - Food diary and calorie tracking
- β Mood Tracking - Mental wellness monitoring
- β Data Synchronization - Watch β Phone data transfer
- β Supabase Backend - Cloud storage and sync
βββββββββββββββββββββββββββββββββββββββ
β Galaxy Watch (Wear OS) β
β - Heart rate monitoring β
β - Activity tracking β
β - Sleep tracking β
β - Real-time sensor data β
ββββββββββββββββ¬βββββββββββββββββββββββ
β Wearable Data Layer
β (MessageClient/DataClient)
ββββββββββββββββΌβββββββββββββββββββββββ
β Android Phone (Companion) β
β - Data visualization β
β - Historical analysis β
β - Detailed reports β
β - Settings management β
ββββββββββββββββ¬βββββββββββββββββββββββ
β Supabase API
ββββββββββββββββΌβββββββββββββββββββββββ
β Supabase Backend β
β - PostgreSQL database β
β - Real-time subscriptions β
β - Authentication β
β - Cloud storage β
βββββββββββββββββββββββββββββββββββββββ
- Model: Galaxy Watch (SM_R930)
- Device ID:
adb-RFAX21TD0NA-FFYRNh._adb-tls-connect._tcp - Platform: Wear OS powered by Samsung
- Purpose: Primary health tracking device
- Run Command:
flutter run -d adb-RFAX21TD0NA-FFYRNh._adb-tls-connect._tcp -t lib/main_wear.dart
- Model: Android Phone (22101320G)
- Device ID:
6ece264d - Purpose: Companion app for data visualization
- Run Command:
flutter run -d 6ece264d -t lib/main.dart
Hardware:
- Galaxy Watch4 or higher (Wear OS 3.0+)
- Android phone (API 23+)
- Both devices paired via Galaxy Wearable app
Software:
- Flutter SDK (3.10.0+)
- Android Studio with Kotlin support
- Samsung Health app installed on watch
- Supabase account (for backend)
-
Clone and setup
git clone <repository-url> cd flowfit flutter pub get
-
Configure Supabase
- Copy
lib/secrets.dart.exampletolib/secrets.dart - Add your Supabase URL and anon key
- Copy
-
Deploy to devices
# Watch app scripts\test-watch.bat # Phone app (in another terminal) scripts\test-phone.bat
- Start phone app first
- Start watch app
- On watch: tap "Heart Rate" β "START"
- Wait for heart rate reading
- Tap "SEND" β check phone receives data
Troubleshooting? See WATCH_CONNECTION_GUIDE.md
The app uses Samsung Health Sensor SDK for real-time heart rate monitoring. See detailed setup guides:
- QUICK_START.md - 5-minute quick start
- SAMSUNG_HEALTH_SETUP_GUIDE.md - Complete setup guide
- IMPLEMENTATION_CHECKLIST.md - Testing checklist
import 'package:flowfit/services/watch_bridge.dart';
final watchBridge = WatchBridgeService();
// 1. Request permission
await watchBridge.requestBodySensorPermission();
// 2. Connect to Samsung Health
await watchBridge.connectToWatch();
// 3. Start tracking
await watchBridge.startHeartRateTracking();
// 4. Listen to heart rate data
watchBridge.heartRateStream.listen((data) {
print('Heart Rate: ${data.bpm} BPM');
print('IBI Values: ${data.ibiValues}');
});
// 5. Stop tracking
await watchBridge.stopHeartRateTracking();HeartRateData {
bpm: 72, // Heart rate in beats per minute
ibiValues: [850, 845, 855], // Inter-beat intervals (ms)
timestamp: DateTime.now(), // When reading was taken
status: SensorStatus.active // active, inactive, error
}-
Clean Dashboard (
lib/screens/wear/wear_dashboard.dart)- Single large "Heart Rate" button
- Minimal, focused design
- Optimized for small screens
-
Heart Rate Monitor (
lib/screens/wear/wear_heart_rate_screen.dart)- Large BPM display (56pt font)
- Simple START/STOP button
- One-tap SEND to phone
- Real-time status indicator
- Samsung Health SDK integration
- IBI data collection
-
Dashboard (
lib/screens/dashboard.dart)- Overview of all health metrics
- Historical data charts
- Sync status
-
Workout Library (
lib/screens/workout/workout_library.dart)- Exercise database
- Workout history
- Performance analytics
-
Nutrition Logger (
lib/screens/nutrition/food_logger.dart)- Food diary
- Calorie tracking
- Nutritional analysis
The app uses Wearable Data Layer API for real-time data transfer:
// On Watch: Send heart rate data
messageClient.sendMessage(
nodeId,
"/heart_rate",
jsonEncode(heartRateData)
);
// On Phone: Receive data
class DataListenerService extends WearableListenerService {
@override
void onMessageReceived(MessageEvent messageEvent) {
final data = jsonDecode(messageEvent.data);
// Process and display data
}
}Both devices sync to Supabase for persistent storage:
// Save heart rate to Supabase
await supabase.from('heart_rates').insert({
'user_id': userId,
'bpm': heartRateData.bpm,
'timestamp': heartRateData.timestamp.toIso8601String(),
'ibi_values': heartRateData.ibiValues,
});flowfit/
βββ android/
β βββ app/
β β βββ libs/
β β β βββ samsung-health-sensor-api-1.4.1.aar
β β βββ src/main/kotlin/com/example/flowfit/
β β βββ MainActivity.kt
β β βββ HealthTrackingManager.kt
β βββ build.gradle.kts
βββ lib/
β βββ main.dart # Phone app entry
β βββ main_wear.dart # Watch app entry
β βββ models/
β β βββ heart_rate_data.dart
β β βββ activity.dart
β β βββ sleep_session.dart
β β βββ mood_log.dart
β βββ services/
β β βββ watch_bridge.dart # Samsung Health SDK bridge
β β βββ supabase_service.dart # Backend service
β β βββ sleep_service.dart
β βββ screens/
β β βββ wear/ # Watch-specific screens
β β βββ workout/
β β βββ sleep/
β β βββ nutrition/
β βββ examples/
β βββ heart_rate_example.dart
βββ docs/ # Documentation
β βββ QUICK_START.md
β βββ SAMSUNG_HEALTH_SETUP_GUIDE.md
β βββ IMPLEMENTATION_CHECKLIST.md
β βββ INSTALLATION_TROUBLESHOOTING.md
β βββ BUILD_FIXES_APPLIED.md
β βββ HEART_RATE_DATA_FLOW.md
β βββ WEAR_OS_SETUP.md
β βββ RUN_INSTRUCTIONS.md
β βββ VGV_IMPROVEMENTS.md
β βββ WEAR_OS_IMPROVEMENTS.md
βββ scripts/ # Build and run scripts
β βββ build_and_install.bat
β βββ run_watch.bat
β βββ run_phone.bat
βββ pubspec.yaml
βββ README.md
"Unresolved reference: ConnectionListener"
# Clean and rebuild
flutter clean
flutter pub get
flutter run -d <device-id>"JVM-target compatibility detected"
- Check
android/app/build.gradle.kts - Ensure
jvmTarget = "17"is set
"Connection Failed" on Watch
- Ensure Samsung Health is installed
- Check watch supports Samsung Health Sensor SDK
- Restart watch and try again
"Permission Denied"
- Go to Settings β Apps β FlowFit β Permissions
- Enable "Body sensors" permission
No Heart Rate Data
- Wear watch on wrist (sensor needs skin contact)
- Tighten watch band
- Clean sensor on back of watch
Watch not sending data to phone
- Check both devices are paired
- Verify Galaxy Wearable app is running
- Check network connectivity
Supabase sync failing
- Verify
secrets.dartconfiguration - Check internet connection
- Review Supabase logs
π Complete Documentation Index - Full list of all documentation
- QUICK_START.md - β Start here! Quick guide to run and test the app
- NAVIGATION_GUIDE.md - πΊοΈ How to access heart rate monitoring UI
- GETTING_STARTED.md - Initial setup guide
- WATCH_TO_PHONE_COMPLETE_FLOW.md - Live data flow from watch to phone
- ALL_ISSUES_FIXED.md - Summary of all fixes applied
- KOTLIN_COMPARISON_ANALYSIS.md - Architecture comparison
- CONNECTION_TIMEOUT_FIX.md - Connection issues
- PHONE_RECEIVER_ISSUE.md - Phone data reception
- SMARTWATCH_TO_PHONE_DATA_FLOW.md - Complete data flow guide
BODY_SENSORS- Heart rate and health sensorsFOREGROUND_SERVICE- Background trackingFOREGROUND_SERVICE_HEALTH- Health-specific servicesWAKE_LOCK- Keep device awake during trackingACTIVITY_RECOGNITION- Activity detection
INTERNET- Supabase syncACCESS_NETWORK_STATE- Network statusWAKE_LOCK- Background sync
- Frontend: Flutter 3.10.0+
- Language: Dart
- Backend: Supabase (PostgreSQL)
- Watch SDK: Samsung Health Sensor SDK 1.4.1
- Wearable: Wear OS 3.0+
- Communication: Wearable Data Layer API
- State Management: Provider
- Charts: fl_chart
- Location: geolocator, google_maps_flutter
- Sensors: sensors_plus, wear_plus
- Complete watch-to-phone data transfer implementation
- Add workout heart rate zones
- Implement HRV analysis and trends
- Add resting heart rate calculation
- Background heart rate monitoring
- Heart rate alerts (too high/low)
- Sleep quality scoring
- Nutrition recommendations
- Social features and challenges
Contributions are welcome! Please read the contributing guidelines before submitting PRs.
This project is licensed under the MIT License - see the LICENSE file for details.
- Samsung Health Sensor SDK
- Flutter team
- Supabase team
- VGV (Very Good Ventures) for Wear OS best practices
For issues and questions:
- Check the troubleshooting section above
- Review the documentation files
- Check logcat:
adb logcat | grep -i health - Open an issue on GitHub
# Automated build and install on watch
scripts\build_and_install.bat
# Run on watch
scripts\run_watch.bat
# Run on phone
scripts\run_phone.bat# Watch (SM_R930 - Galaxy Watch)
flutter run -d adb-RFAX21TD0NA-FFYRNh._adb-tls-connect._tcp -t lib/main_wear.dart
# Phone (22101320G)
flutter run -d 6ece264d -t lib/main.dart
β οΈ Important: Always use-t lib/main_wear.dartfor watch to get Wear OS UI, not phone UI!
# View logs
adb -s 6ece264d logcat | findstr "FlowFit"
# Check devices
adb devices
# Uninstall
adb -s 6ece264d uninstall com.example.flowfitFor detailed documentation, see the docs/ folder.