Debt Tracker
An offline Android expense tracker on Google Play that shares a group as a file, with no account or server.
Live on Google Play
Description
I was tracking debts between friends with a notes app and a calculator, which meant recalculating by hand whenever anything moved. I wanted something that kept the ledger, ran recurring charges on its own, and kept the data on my phone instead of a company's server. Shared groups are where apps like this usually make everyone sign in to the same service, so this one moves a group between phones as a file. Once it worked, I published it on Google Play.
Block diagram
- Compose UI
- ViewModel
- DebtRepository
- Room / SQLite
Decisions
A balance and its transaction commit together
Every balance update and the transaction row that caused it run inside one Room transaction, so if the insert throws, the balance does not move. The app tracks money between people, and a half-written update is not acceptable. Recurring charges follow the same rule: on startup each missed period fires inside a transaction, up to a fixed ceiling, after which the schedule fast-forwards instead of filling the ledger with backlog.
Shared groups with no server
A group travels as a .dtgroup.json file over the system share sheet. Every phone keeps its own ledger and merges any file it receives, in any order and any number of times. An expense's money merges as one unit on its own timestamp, while the description, category and date each carry theirs, so two people who change different parts of the same expense (the money, the description, the category or the date) both keep their changes. Stamps come from each phone's wall clock and are capped at the file's export time, and equal stamps fall back to a comparison both phones compute the same way. The costs: nothing syncs by itself, and a phone whose clock runs fast wins edits made close together.
Backups outside the sandbox, Android Auto Backup off
Automatic backups run on launch and through WorkManager, written with the Storage Access Framework to a folder the user picks, so they survive an uninstall without a cloud account. Retention keeps daily, weekly and monthly tiers and prunes the rest. Android's own Auto Backup was turned off in 3.4.0 because it had been copying the database to the user's Google Drive and restoring it after a reinstall. A reinstall now starts clean.
Errata
- At the largest system font size, the group card on the Groups tab loses the group name and wraps the member count letter by letter.
- In phone landscape, the Add button covers the end of the Pay off button on a group's screen until the list scrolls.
Revision history
| Version | Changes |
|---|---|
| 3.4.3 | Removed the portrait lock the Play Console flagged; the app rotates and keeps an open sheet and a typed amount through the turn. |
| 3.4.2 | Removed enableEdgeToEdge() and its deprecated window calls; the theme sets the bar icons through the inset controller. |
| 3.4.1 | Chart pass: spend bars show share, amount still owed and surplus separately, and the Totals and person charts show their scale. |
| 3.4.0 | Shared groups as .dtgroup.json files merged on every phone; Android Auto Backup turned off so a reinstall starts clean. |