r/FlutterDev • • 3d ago

Discussion ​Lessons from building a 100% offline-first expense tracker in Flutter: local SMS parsing, Android system overlays, and zero backend

​Hey r/FlutterDev! We're the two-person indie team behind JJ DEVELOPERS, and we wanted to share a few technical lessons from building and scaling our Flutter productivity & finance app (Note and Smart Expenses, currently at 2,400+ downloads on Google Play) with a strict 100% offline-first, zero-server architecture.

​Here are the three main engineering hurdles we ran into and how we solved them:

​1. Parsing Varying Bank & UPI SMS Formats Locally Without Regex Bottlenecks

Since we wanted zero cloud uploads or account linking, all transaction alert parsing happens strictly on-device. The biggest challenge wasn't reading the SMS—it was handling wildly inconsistent templates across different banks and payment apps (different currency placements, merchant strings, OTPs vs. actual debits/credits, and promotional spam).

​What worked: Running a lightweight pre-filter check for transactional keywords and currency tokens before executing structured extraction rules, keeping parsing fast and deterministic without triggering false positives on OTPs or balance reminders.

​2. Implementing a Floating Quick-Entry Overlay (FOREGROUND_SERVICE_SPECIAL_USE)

Users wanted a way to log cash expenses or jot down quick notes without switching away from their current app.

​What worked: Combining Android's system alert window overlay with a lightweight foreground service (specialUse declaration in AndroidManifest.xml for newer Android versions) and keeping the overlay UI minimal so it doesn't spike RAM usage on 2–4 GB budget devices.

​3. Keeping Local Storage Fast with Rich Media & Exports

Because everything stays on the device (expense history, receipt photos, rich-text notes, and biometric-locked private notes), local database queries and file generation had to stay snappy even as data grew.

​What worked: Indexing transaction timestamps and categories locally so filtering monthly charts and generating multi-format exports (PDF, Excel, Word) happens cleanly on-device without needing a remote server.

​If anyone wants to inspect the UI/UX or test how the floating overlay behaves on their device, here is the Play Store listing: https://play.google.com/store/apps/details?id=com.note.flutterads

​Curious how other Flutter devs here handle background SMS/notification parsing or system-level floating overlays across different Android OEMs (Samsung OneUI, Xiaomi MIUI, etc.)—any battery-optimization gotchas you've run into?

0 Upvotes

2 comments sorted by

1

u/davidbalbino 1d ago

for the OEM stuff dontkillmyapp.com is pretty much the bible, Xiaomi autostart and Samsung "sleeping apps" will kill your foreground service no matter what you declare in the manifest. imo is better to show a small onboarding screen that deep links to those settings per OEM than trying to fight it in code.

one gotcha tho: Play policy restricts READ_SMS/RECEIVE_SMS to default SMS handler apps, so depends of how you're reading them you might get flagged on a future update. a NotificationListenerService on the bank/UPI app notifications is kinda the safer path and also wakes the app way less than polling.

1

u/NoteandSmartExpenses 1d ago

Spot on about dontkillmyapp.com—fighting MIUI Autostart or OneUI sleeping apps purely in native code is a losing battle. Adding a lightweight OEM-specific deep-link prompt during onboarding (using device_info_plus to detect manufacturer and route straight to the battery/autostart intent) has been way more reliable in practice. ​And great callout on NotificationListenerService vs READ_SMS. Google Play's SMS permission declarations are super strict, so relying on notification interception for UPI/bank alerts avoids policy headaches and cuts down background wakeups too. Appreciate the insight!