On this page
Most people only remember to drink water when their head starts hurting at 4pm. This brief builds a small, friendly fix: set a daily goal, tap once for every glass, get a nudge roughly every hour while you are awake, and watch a glass on your home screen fill up through the day. Android is the best fit, because a Jetpack Glance widget can show progress and take a tap without opening the app, and WorkManager handles the nudges. The iPhone version uses WidgetKit and local notifications, and it needs a Mac with Xcode to build. The first proof: three taps on the widget raise today's total by three glasses, and the glass drawing matches the number.
Screens
- Today: A big glass that fills toward the goal, the amount so far and a plus button for one glass.
- Quick add: Preset sizes such as a 250 ml glass, a 500 ml bottle and a custom amount.
- History: The last seven days as simple bars, with goal days marked.
- Reminders: Wake and sleep times, how often to nudge and a pause for today.
- Widget setup: A short guide to adding the home screen glass, with a preview.
Data model
| Table | Key fields | Purpose |
|---|---|---|
| drink_logs | id (uuid), amount_ml (int), logged_at (timestamptz), local_day (date), source (text) | One row per glass, whether it came from the app, the widget or a notification action. |
| daily_goals | local_day (date), goal_ml (int) | The goal that applied on each day, so changing it today does not rewrite last week. |
| reminder_settings | id (int), wake_time (time), sleep_time (time), interval_min (int), paused_until (timestamptz) | When nudges are allowed and how often they come. |
This app needs no account and no server. Keep logs in Room and read today's total from the rows rather than from a stored counter, so a widget tap and an in-app tap at the same moment cannot overwrite each other. Store local_day with each log so travelling across time zones does not move yesterday's glasses into today. If the owner later wants a family challenge or a backup, connect your own Supabase with row-level security per person, and keep the offline log as the source of truth.
Native features
The widget is the reason this belongs on a phone rather than in a browser tab. Glance draws the glass from the latest total and runs an action callback when the plus button is tapped, so logging takes one touch from the home screen. Reminders run through WorkManager, which batches work to save battery: the nudge arrives close to the hour, not to the second, and the copy should say so honestly.
| Feature | Android (Kotlin) | iPhone (SwiftUI) | Notes |
|---|---|---|---|
| Home screen glass | Jetpack Glance AppWidget with an ActionCallback | WidgetKit with an AppIntent button (iOS 17 and later) | Refresh the widget after every log so the drawing never lags behind the number. |
| Nudges | WorkManager periodic work plus a notification channel | UNCalendarNotificationTrigger for each waking hour | Skip nudges outside wake hours and once the goal is reached. |
| Log from the nudge | Notification action with a BroadcastReceiver | UNNotificationAction handled by the app delegate | One tap on the notification should add a glass without opening the app. |
| Health data | Health Connect hydration records (optional, later) | HealthKit dietary water (optional, later) | Needs extra permission declarations and a separate check before it is added. |
Android notes (Kotlin and Jetpack Compose)
Build the Today screen and the widget from the same Room flow, so both always show one number. Keep drawing code simple: a rounded glass outline with a filled rectangle clipped inside it reads clearly even at the smallest widget size.
- Create a GlanceAppWidget with a size-responsive layout and an ActionCallback that inserts a drink_logs row with source set to widget, then calls update on every widget instance. Test both a 2x2 and a 4x2 size.
- Schedule a PeriodicWorkRequest of about an hour; inside the worker, check wake and sleep times, today's total and paused_until before posting. Ask for POST_NOTIFICATIONS on Android 13 and later, and keep the widget useful if permission is denied.
- On a real phone, add the widget, tap it three times, open the app and confirm three rows with source widget. Change the clock past midnight and confirm the glass empties for the new day while yesterday stays in History.
iPhone notes (Swift and SwiftUI)
On iPhone, an interactive widget built with an AppIntent can add a glass straight from the home screen on iOS 17 and later. Share the store between app and widget through an App Group so both read the same SwiftData records.
- Write the AppIntent's perform method to insert one log and return, then call WidgetCenter.shared.reloadAllTimelines from the app after in-app logs so the glass stays in step.
- iOS caps how many local notifications can wait at once, so schedule only today's and tomorrow's waking-hour nudges and refresh the schedule each time the app opens.
- Test on an iPhone with the widget on the home screen and the largest text size: the amount label must stay readable, and a tap must work while the phone is offline.
Copy-paste prompt
I always forget to drink water until I get a headache. Build me a cute water reminder for Android. Screens: Today, Quick add, History, Reminders and Widget setup. I set a daily goal in ml, tap once per glass, and pick sizes like 250 ml or a 500 ml bottle. Add a home screen widget that looks like a glass and fills up as I drink, with a plus button so I can log without opening the app. Nudge me roughly every hour between my wake and sleep times, stop once I hit my goal, and let me log a glass straight from the notification. Save drink_logs, daily_goals and reminder_settings on the phone only: no account, no ads, no tracking. Show a seven-day history with goal days marked. Handle denied notifications, a new day at midnight and changing the goal mid-day. Acceptance: three widget taps add three glasses, the app shows the same total, and the glass is empty again tomorrow morning.
Opens Apirex with this prompt in the box. Pick the Android · Kotlin tab before you send.
Acceptance test
- Set a 2,000 ml goal and wake hours of 8am to 11pm, then add the widget to the home screen.
- Tap the widget plus button three times and confirm the glass fills to 750 ml and the app shows the same amount.
- Wait for a nudge, log a glass from the notification action and check the widget updates without opening the app.
- Reach the goal and confirm no further nudges arrive today; change the goal and confirm earlier days keep their old goal.
- Deny notifications and confirm the Reminders screen says nudges are off while logging and the widget still work.
Watch battery and honesty too. Leave the phone idle for an afternoon and check the nudges arrived roughly hourly, not in a burst after unlocking. The Reminders screen should describe timing as approximate, and any copy about health should stay general: this is a habit helper, not medical advice.
Frequently asked questions
Will it remind me exactly on the hour?
Not to the minute. Android batches background work to save battery, so a nudge lands close to the hour. That is fine for drinking water, and the app should say so instead of promising exact timing.
Can it read my water intake from Health Connect?
Not in this version. Syncing with Health Connect or HealthKit needs extra permissions and declarations, so treat it as a later step that should be checked before you promise it to users.
Why build it as a native app instead of a website?
The home screen glass and the log-from-notification button are the whole point. A website cannot place an interactive widget on your home screen. The iPhone build works too, and it needs a Mac with Xcode.
Build this blueprint
The blueprint prompt, ready for your platform. Edit anything before you send it.
Opens Apirex with this prompt. Pick the Android · Kotlin tab before you send. The Free plan includes 5 Rex Credits a day.