My grandmother has diabetes and used to track her blood sugar in a handwritten notebook. As the pages piled up, finding old records became impossible — every doctor's visit meant flipping through stacks of paper. I built this app to make tracking effortless and sharing with doctors instant.
A lightweight, offline-first Android blood sugar recording app designed for elderly users. Built with Kotlin, Jetpack Compose, and Material 3.
- Quick Recording — 6 meal segments (before/after breakfast, lunch, dinner) with automatic time-based inference
- Medication Tracking — Log medications with name, dosage, and notes; edit/delete with one tap
- Statistics Summary — Collapsible card showing average, max, min glucose per meal segment
- Unit Toggle — Switch between mmol/L and mg/dL with one tap (persists across restarts)
- PDF Export — One-tap report generation with stats + full record table, share via Bluetooth, email, or print
- Copy Summary — One-tap clipboard copy for quick sharing via messaging apps
- Trend Chart — Smooth bezier curves with gradient fill, month/year toggle, and normal-range indicator
- Time Grouping — Records grouped by This Month / This Year / Earlier with collapsible headers
- Bilingual — Chinese and English UI, follows system language automatically
- Accessibility — Large fonts for elderly users, WCAG AA color contrast for glucose status indicators
- Data Safety — Room database with migration framework — APK updates never delete your data
- Privacy — Fully offline. Zero data collection. All records stay on your device.
| Main Screen | Record Dialog | Statistics | Trend Chart | Medications |
|---|---|---|---|---|
![]() |
![]() |
![]() |
![]() |
![]() |
| Component | Version | Notes |
|---|---|---|
| AGP | 7.4.2 | Compatible with JDK 11 |
| Kotlin | 1.8.22 | Compose Compiler 1.4.8 |
| JDK | 11 | Eclipse Adoptium |
| Compose BOM | 2023.06.01 | |
| Room | 2.5.2 | Using kapt |
Zero third-party dependencies — PDF generation uses Android's native PdfDocument API. Charts are drawn with Compose Canvas. No charting libraries, no PDF libraries.
app/src/main/java/com/bloodsugar/
├── MainActivity.kt # Entry point
├── data/
│ ├── AppDatabase.kt # Room database with migration framework
│ ├── Record.kt # Entity: id, value, segment, note, timestamp
│ ├── RecordDao.kt # DAO: Flow queries + SQL aggregation
│ ├── Medication.kt # Entity: id, name, dosage, note, timestamp
│ ├── MedicationDao.kt # DAO: Flow queries for medications
│ └── SegmentStats.kt # Stats data class
├── ui/
│ ├── MainScreen.kt # Main UI: header + stats card + grouped list
│ ├── MainViewModel.kt # State management (MVVM)
│ ├── RecordSheet.kt # Record entry/edit dialog
│ ├── MedicationSheet.kt # Medication add/edit dialog
│ ├── ChartOverlay.kt # Trend chart (bezier curves + gradient)
│ ├── StatsSummaryCard.kt # Collapsible statistics card
│ ├── PdfExporter.kt # PDF report generation (zero dependencies)
│ └── theme/ # Colors, typography, Material 3 theme
└── util/
├── GlucoseValidator.kt # Input validation
├── GlucoseUnit.kt # mmol/L ↔ mg/dL conversion
└── MealSegment.kt # 6 meal segments + time-based inference
- MVVM — ViewModel talks directly to DAO (no Repository layer, no DI)
- Jetpack Compose — 100% declarative UI
- Material 3 — Design system with light/dark theme
- StateFlow — Reactive state management
- Unit Tests — 22 tests covering validation, unit conversion, and meal segments
# Set JAVA_HOME (adjust path for your system)
export JAVA_HOME="/path/to/jdk-11"
# Build debug APK
./gradlew assembleDebug
# Output: app/build/outputs/apk/debug/app-debug.apk- Download the APK from Releases or build from source
- Enable "Install from unknown sources" on your Android device
- Install the APK
- Create
app/src/main/res/values-<locale>/strings.xml - Copy all entries from
app/src/main/res/values/strings.xml(Chinese) orvalues-en/strings.xml(English) - Translate the values
- No
fallbackToDestructiveMigration()— updates never destroy your data - APK overlay installs preserve all existing records
- Schema changes use Room's
Migrationframework with SQL scripts
Contributions are welcome! Feel free to open issues or submit pull requests.
MIT License — free to use, modify, and distribute.
Diabetes management requires consistent tracking, but existing apps are often bloated, ad-supported, or require cloud accounts. This app is:
- Dead simple — designed for people who find smartphones confusing
- Fully offline — no account, no cloud, no tracking
- Zero cost — no ads, no subscriptions, no paywalls
- Shareable — one-tap PDF export for doctor visits
Built with care for those who need it most.




