Android: notify at a task's due time #151

Merged
CrowderSoup merged 2 commits from crowdersoup/due-time-notifications into main 2026-12-03 04:42:34 +00:00 AGit
Owner

Closes vTodo task #475. Phone notifications at a task's due time replace Gerald's reminders.

How it works

  • The phone sets an exact alarm for each of your open tasks (My work) that has a due date and a due time, using what it last synced. Nothing is pushed from the server.
  • Alarms are set again after every sync and every change in the app or the widget, at boot, after an app update, and when the clock or time zone changes. Alarms for tasks that are now done, gone or moved are cancelled, and any notification already showing for them is cleared.
  • Tapping a notification opens the task. Done completes it through the server's move, the same as checking it off, so a repeating task comes back with its next due date and its next reminder. If that fails, the notification comes back with the reason.
  • A reminder that came due within the last 30 minutes before the phone could notify (the phone was off, or the task arrived in a later sync) shows right away, once, marked "Was due".
  • Android 13+ asks for notification permission once, after the first sign-in.

Code

  • today/Reminders.kt holds the planning logic (pure, with unit tests in RemindersTest).
  • notify/ handles alarms, notifications and the receivers.
  • refreshOnPhone() replaces the refreshTodayWidget() calls. It refreshes the widget and then the reminders.

Known limits

  • A due time added or changed on the website only takes effect after the phone syncs: when you open the app, or within about 30 minutes in the background.
  • The app uses USE_EXACT_ALARM, which is fine for a sideloaded APK but needs a policy review if vTodo ever goes on Google Play.
  • There's no "remind me earlier" (lead time) yet.

Tests
CI (run 207) passed the unit tests, the debug build, and the release lint and build. I haven't tested it on a phone yet.

Closes vTodo task #475. Phone notifications at a task's due time replace Gerald's reminders. **How it works** - The phone sets an exact alarm for each of your open tasks (My work) that has a due date and a due time, using what it last synced. Nothing is pushed from the server. - Alarms are set again after every sync and every change in the app or the widget, at boot, after an app update, and when the clock or time zone changes. Alarms for tasks that are now done, gone or moved are cancelled, and any notification already showing for them is cleared. - Tapping a notification opens the task. **Done** completes it through the server's move, the same as checking it off, so a repeating task comes back with its next due date and its next reminder. If that fails, the notification comes back with the reason. - A reminder that came due within the last 30 minutes before the phone could notify (the phone was off, or the task arrived in a later sync) shows right away, once, marked "Was due". - Android 13+ asks for notification permission once, after the first sign-in. **Code** - `today/Reminders.kt` holds the planning logic (pure, with unit tests in `RemindersTest`). - `notify/` handles alarms, notifications and the receivers. - `refreshOnPhone()` replaces the `refreshTodayWidget()` calls. It refreshes the widget and then the reminders. **Known limits** - A due time added or changed on the website only takes effect after the phone syncs: when you open the app, or within about 30 minutes in the background. - The app uses `USE_EXACT_ALARM`, which is fine for a sideloaded APK but needs a policy review if vTodo ever goes on Google Play. - There's no "remind me earlier" (lead time) yet. **Tests** CI (run 207) passed the unit tests, the debug build, and the release lint and build. I haven't tested it on a phone yet.
Android: notify at a task's due time
Some checks failed
android / apk (push) Failing after 9m20s
56e2daf191
The phone sets an exact alarm for each of your open tasks with a due date
and time, from what it last synced, and sets them again after every sync
and change, at boot, after an update and when the clock or time zone
changes. Tapping the notification opens the task; Done completes it through
the server's move, so repeating tasks roll forward. A reminder that came
due in the last 30 minutes before the phone could notify shows late, once.

Android 13+ asks for notification permission once, after sign-in.

Replaces Gerald's reminders (#475).
Ask for notification permission through Compose's launcher
All checks were successful
android / apk (push) Successful in 9m44s
1a1c87d22d
registerForActivityResult tripped lint's InvalidFragmentVersionForActivityResult
on the release build.
Sign in to join this conversation.
No description provided.