Menu

Parsing Bank SMS From India on Android: 9 Edge Cases From Real Messages (Kotlin)
📰

Parsing Bank SMS From India on Android: 9 Edge Cases From Real Messages (Kotlin)

DEV Community: kotlin·Yogin Parmar·1 day ago
#pdtZuR1l
#devtokotlin#devto#dev#bank#amount
Long article (1809 words) — no AI summary yet.
Reading 0:00
15s threshold

A parser that looks for "credit" and "debit" breaks on the first card SMS it meets: "Rs.499 spent on HDFC Bank Credit Card" contains the word "Credit" and is a spend. Most of what I learned writing a parser for bank SMS in India looks like that: the formats are easy to match, and the words are what mislead you.

I'm building DailyBudget, an Android budget app that reads bank SMS on the phone and turns them into one number: what you can spend today. It has no INTERNET permission, so all of this runs on the device. It reads HDFC Bank, SBI, ICICI Bank, Axis Bank, Kotak, PNB, Bank of Baroda and Canara Bank by SMS, plus FamPay through app notifications.

Short version: read new SMS with a BroadcastReceiver on SMS_RECEIVED and old ones with a ContentResolver query on the inbox, filter by the bank's DLT sender ID, then parse with one small regex spec per bank (amount, direction, merchant, reference).…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.