Case study: CS 360, Mobile Architect and Programming
Android weight tracker
I designed this app in one project, gave it screens in the next, and in the last one made it real: a SQLite database behind every screen, passwords that are never stored, and a text message that is actually sent. Then I made sure it could ship.
- Of active Android devices can run it, up from 54% at the minimum I started with
- 96%
- Of active Android devices can run it, up from 54% at the minimum I started with
- Automated tests: 26 unit tests and 22 that run on a real SQLite database
- 48
- Automated tests: 26 unit tests and 22 that run on a real SQLite database
- Lint errors or warnings, with the build set to fail on any
- 0
- Lint errors or warnings, with the build set to fail on any
- My role
- Solo: design, code, tests and documentation
- When
- Summer 2026, submitted in August
- Stack
- Java, Android, SQLite, Material 3, JUnit
01
Where it started
The app is for someone working toward a target weight. They log one weight a day, set a goal, and get a text the day they reach it. Everything stays on the phone.
The course split it into three projects. The first was a written proposal, the second built the five screens with nothing behind them, and the third had to make it work. Both earlier projects came back with full marks and no changes requested.
| Area | Earlier projects | The finished app |
|---|---|---|
| Data | Held back on purpose: screens with nothing behind them | SQLite behind every screen, three tables |
| Passwords | The proposal stored the password | A salt and a PBKDF2 hash, the password never written |
| One weight a day | Checked in the screen by searching the list | A UNIQUE constraint, so no code path can break it |
| Text alert | Designed, never sent | A real text, with its delivery result reported |
| Alerts answered | Saved on the phone install | Saved on the account |
| Oldest Android | API 34, about 54% of devices | API 26, about 96% of devices |
| Screen sizes | Phone layouts | Phone and tablet, in both orientations |
02
Decisions that mattered
Each one came with a cost. Here is what I chose, and what I gave up for it.
Store a hash, not the password
My own approved proposal said the users table would hold a password. I changed that on purpose. Each account gets a random salt and a PBKDF2-HMAC-SHA256 hash, and the typed password is never written anywhere. People reuse passwords, so a stolen database rarely hurts only the app it came from.
The trade-off: checking a password is slow on purpose. It runs on a background thread, and the login screen shows a progress bar and disables its buttons while it works.
Let the database enforce the rules
One weight per day is a UNIQUE constraint on the account and date, not a check in the screen. Saving a second weight for the same day corrects that day instead of failing. Usernames ignore case, so a capital letter one morning never splits an account in two.
SQLite ignores foreign keys unless you switch them on, so the app does, and a test proves a weight cannot be saved for an account that does not exist. Every query binds its values, so a quote in a username is just a quote.
Never claim a text was sent before it was
Android's send call returns nothing, so calling it only means the message was handed off. The app asks for a delivery report and tells the user what actually happened. All alerts go through one class that checks permission first, so no path can skip the check.
The app works in all four cases: a text, a system notification, both, or neither, where an in-app message offers to turn alerts on. I tested it with both permissions revoked.
Keep health data off the cloud
Android backs app data up to Google by default. For this app that would copy a record of someone's weight over time, plus their password hashes, to a server. The proposal promised the data stays on the device, so I turned backup off.
The trade-off: someone who changes phones starts over. I chose that on purpose and wrote it down.
Make it shippable, not just gradeable
Google Play requires apps to target Android 16 from 31 August 2026, so I targeted it. I also lowered the oldest supported version from API 34 to API 26, which raised the reach from about 54% to about 96% of active devices.
The trade-off: older versions miss newer features. Lint's compatibility check, set to fail the build, proves no newer call slipped through, and accessibility headings moved into code so they still work on Android 8.
03
How I tested it
Passing tests was the start. I drove the app on an emulator and two tablet sizes, and read the database straight off the device at each step to check that the screen and the data agreed.
Pixel 8 emulator, Android 16
Every create, edit, delete and undo changed the screen and the database together. A goal-reaching weight sent a real text, and the stored password appeared in no column.
Tablet at 1280 by 800
I measured the rendered layout instead of eyeballing it. Both panes and the width cap matched the values in the layout files, in both orientations.
7 inch tablet, Android 11
The oldest setup in practice. It asked for one permission instead of two, as it should, and still sent the text through the older Android code path.
Ten problems my own testing caught
All fixed before I submitted. Three of them:
- The goal check
- The congratulation tested the weight just typed, while the rest of the screen used the newest entry. Correcting an old day below the goal sent a real text under a card still counting down. It now asks the same question as the rest of the screen.
- The keyboard on Android 11
- Drawing edge to edge meant the keyboard could cover the login buttons. Pressing Done on the keyboard now signs in, so the common path never needs them.
- A test that was wrong
- A rounding test failed on 172.45. The app records one decimal place, so 172.5 was right and the test was not. I fixed the test and pinned the rounding rule.
04
Check my work
Open the folder in Android Studio and run it on Android 8.0 or newer. The repository's README has a five minute walkthrough that touches every feature. From the command line:
# lint, then the unit tests ./gradlew :app:lintDebug ./gradlew :app:testDebugUnitTest # the database tests, on a connected device or emulator ./gradlew :app:connectedDebugAndroidTest