A comprehensive Android app for diabetes management with interactive graphs, health metrics, and smart tracking.
SweetSync is a modern Android application designed to help users manage their diabetes by tracking blood sugar readings, visualizing health trends, and providing insights through interactive charts and analytics. Built with the latest Android technologies and powered by Firebase, it offers a seamless experience for monitoring glucose levels, real-time data synchronization, and understanding patterns in your health data.
Note: Version 2.0.0 (October 2025) - Complete Firebase migration with enhanced features, better offline support, and real-time data sync!
- Log blood glucose readings with timestamps
- Track readings before and after meals
- Add personal notes to each reading
- View comprehensive reading history
- Monitor trends over time
- Beautiful, interactive charts and graphs
- Daily, weekly, and monthly trend analysis
- Quick statistics dashboard
- Color-coded glucose level indicators
- Export capabilities for healthcare providers
- Firebase Authentication for secure user management
- Cloud Firestore for real-time data synchronization
- Built-in offline persistence and automatic sync
- Firestore Security Rules for data privacy
- Automatic conflict resolution and data backup
- Dark theme with custom color palette
- Material 3 design components
- Intuitive navigation and user flow
- Responsive design for all screen sizes
- Smooth animations and transitions
- Average glucose level calculations
- Normal, high, and low reading counts
- Meal context analysis
- Trend identification and alerts
- Progress tracking over time
SweetSync follows modern Android development best practices with a clean, maintainable architecture:
- Model: Data models and repositories
- View: Jetpack Compose UI components
- ViewModel: Business logic and state management
- Repository Pattern: Centralized data management
- Dependency Injection: Hilt for clean architecture
- Navigation Component: Seamless screen navigation
- State Management: Compose state and ViewModels
| Category | Technology | Version |
|---|---|---|
| Language | Kotlin | 2.0.0 |
| UI Framework | Jetpack Compose | BOM 2024.09.03 |
| Architecture | MVVM + Repository | - |
| Dependency Injection | Hilt | 2.48 |
| Backend | Firebase | BOM 32.7.0 |
| Database | Cloud Firestore | Latest |
| Authentication | Firebase Auth | Latest |
| Navigation | Navigation Compose | 2.8.2 |
| Charts | MPAndroidChart | 3.1.0 |
| Serialization | Kotlinx Serialization | 1.7.3 |
| Build System | Gradle (Kotlin DSL) | 8.12.3 |
- Android Studio: Arctic Fox or later
- Android SDK: API 26+ (Android 8.0)
- Kotlin: 1.8+
- Gradle: 8.0+
- Java: 11+
-
Clone the repository
git clone https://github.com/daemon-001/SweetSync.git cd SweetSync -
Open in Android Studio
- Launch Android Studio
- Open the project folder
- Wait for Gradle sync to complete
-
Configure Firebase
- Create a Firebase project at Firebase Console
- Enable Firebase Authentication (Email/Password)
- Create a Cloud Firestore database
- Download
google-services.jsonand place inapp/directory - Set up Firestore Security Rules (see Security Setup below)
-
Build and Run
- Connect an Android device or start an emulator
- Click the "Run" button in Android Studio
- Or run from command line:
./gradlew assembleDebug
-
Create Firebase Project
- Go to Firebase Console
- Click "Add Project" and follow the wizard
- Select your project
-
Register Android App
- Click Android icon to add Android app
- Package name:
com.daemon.sweetsync - Download
google-services.json - Place it in
app/directory
-
Enable Authentication
- Go to Authentication β Sign-in method
- Enable "Email/Password" provider
- Save changes
-
Create Firestore Database
- Go to Firestore Database
- Click "Create database"
- Choose production mode
- Select your preferred location
-
Set up Security Rules Copy the following rules to Firestore β Rules:
rules_version = '2'; service cloud.firestore { match /databases/{database}/documents { // Helper functions function isAuthenticated() { return request.auth != null; } function isOwner(userId) { return request.auth.uid == userId; } // User profiles match /user_profiles/{userId} { allow read, write: if isAuthenticated() && isOwner(userId); } // Blood sugar readings match /blood_sugar_readings/{readingId} { allow read: if isAuthenticated() && isOwner(resource.data.user_id); allow create: if isAuthenticated() && isOwner(request.resource.data.user_id); allow update, delete: if isAuthenticated() && isOwner(resource.data.user_id); } } }
-
Create Firestore Indexes Create these composite indexes in Firestore β Indexes:
Index 1:
- Collection:
blood_sugar_readings - Fields:
user_id(Ascending),timestamp(Descending)
Index 2:
- Collection:
blood_sugar_readings - Fields:
user_id(Ascending),timestamp(Ascending)
- Collection:
@Serializable
data class BloodSugarReading(
@DocumentId
val id: String? = null,
@PropertyName("user_id")
val user_id: String = "",
@PropertyName("glucose_level")
val glucose_level: Double = 0.0,
@PropertyName("timestamp")
val timestamp: Long = 0L, // Milliseconds since epoch
@PropertyName("notes")
val notes: String? = null,
@PropertyName("meal_context")
val meal_context: String = MealContext.BEFORE_MEAL.name
) {
constructor() : this(null, "", 0.0, 0L, null, MealContext.BEFORE_MEAL.name)
fun getMealContextEnum(): MealContext {
return MealContext.valueOf(meal_context)
}
}
@Serializable
enum class MealContext {
@SerialName("BEFORE_MEAL")
BEFORE_MEAL,
@SerialName("AFTER_MEAL")
AFTER_MEAL
}@Serializable
data class UserProfile(
val id: String = "",
val email: String = "",
val name: String = "",
val created_at: Long = 0L
) {
constructor() : this("", "", "", 0L)
}app/src/main/java/com/daemon/sweetsync/
βββ data/
β βββ model/ # Data models
β β βββ BloodSugarReading.kt
β βββ repository/ # Data repositories
β βββ AuthRepository.kt
β βββ BloodSugarRepository.kt
β βββ FirebaseClient.kt
βββ di/ # Dependency injection
β βββ DatabaseModule.kt
βββ presentation/
β βββ navigation/ # Navigation components
β β βββ SweetSyncNavigation.kt
β βββ screen/ # UI screens
β β βββ AddReadingScreen.kt
β β βββ AuthScreen.kt
β β βββ ChartsScreen.kt
β β βββ HomeScreen.kt
β βββ viewmodel/ # ViewModels
β βββ AuthViewModel.kt
β βββ BloodSugarViewModel.kt
βββ ui/theme/ # UI themes and styling
β βββ Color.kt
β βββ Theme.kt
β βββ Type.kt
βββ utils/ # Utility classes
β βββ DateTimeUtils.kt
βββ MainActivity.kt # Main activity
βββ SweetSyncApplication.kt # Application class
- Authentication: Secure user login with Firebase Authentication
- Data Privacy: Firestore Security Rules ensure users only access their own data
- Encryption: All data transmitted over HTTPS/TLS
- Offline Security: Data cached securely with Firebase offline persistence
- Session Management: Automatic token refresh and secure logout
- Data Validation: Server-side validation through security rules (glucose range, meal context)
- API Key Protection: Restricted API keys prevent unauthorized access
# Unit tests
./gradlew test
# Instrumented tests
./gradlew connectedAndroidTest
# All tests
./gradlew check- Unit tests for ViewModels
- Integration tests for repository layer
- UI tests for critical user flows
- End-to-end tests for complete user journeys
./gradlew assembleDebug./gradlew assembleReleaseGenerated APKs can be found in:
app/build/outputs/apk/debug/
app/build/outputs/apk/release/
If you encounter any issues or have questions:
- Check the Issues - Look through existing issues
- Create a New Issue - Provide detailed information about the problem
- Include Device Info - Android version, device model, app version
- Attach Logs - Include relevant error logs if possible
| Version | Date | Description |
|---|---|---|
| 2.0.0 | October 2025 | Firebase migration with real-time sync & offline support |
| 1.0.0 | June 2025 | Initial release with Supabase backend |
See CHANGELOG.md for detailed version history.
- Developer: daemon-001
- Email: nitesh.kumar4work@gmail.com
- LinkedIn: linkedin.com/in/daemon001
Help us improve SweetSync by contributing, reporting bugs, or suggesting new features!
