-2

I'm making an app for managing money. It includes entering your payments and expenses.

To make it slightly innovative I wanted to do the following - Whenever we withdraw using a CC, we always get a message(SMS) from the bank that a certain amount has been withdrawn. I wanted my app to detect such messages, extract the number specifying amount withdrawn,save it and then subtract that from the income the user has entered in the app (his balance).

Still new to this, can any help me with the code here?

Edit - Sorry, but the problem is that I'm not sure how to tackle this. Saw something similar here - Android - Extract text from SMS

But wasnt sure if that can be applied here.

This is an example of an SMS received from a bank - https://i.stack.imgur.com/1sI30.jpg

What I was thinking is that searching for a string like "available balance" and extracting and saving a number that follows such a text

Community
  • 1
  • 1
Amol Pednekar
  • 127
  • 1
  • 8

2 Answers2

1

I think you can implement an automated application to do this. (Sorry, but I can't code that application since this site is not intended for that)

You need to implement a BroadcastReceiver for reading incoming messages. If you find a message containing

BOI Star Sandesh...

then you can look for specific word (Credited, Debited), date and available balance.

Finally you could visualise those data using a chart, table, or list with transaction history.

Come here again with specific question about implementing.

Good luck!

Roberto Tellez Ibarra
  • 2,146
  • 3
  • 18
  • 34
  • Thank You! I was looking for someone to direct me towards getting a solution, and this definitely helps! I'll see what I can come up with and bump this thread. – Amol Pednekar Jul 15 '15 at 14:56
  • You're welcome. I enjoy building this type of utility solution, but I have a lot of work for now. Please, vote up and accept my answer. Good luck, Roberto. – Roberto Tellez Ibarra Jul 15 '15 at 18:08
  • I have implemented a part of this, and am able to extract specific keywords from the message received as asked here initially. The problem is that the app needs to be open in the background atleast, if not running, for it to read a new message and extract the reqd info. Else, if the message is deleted before opening the app (or not running in the background), the message contents arent extracted. Its a boundary case, but something that needs to be handled. How can I do this? – Amol Pednekar Jan 01 '16 at 10:35
  • Is there any link which shows all bank SMS Addess. So i can easily find bank name. – Vishal Jadav Feb 09 '17 at 10:52
1

Please check https://github.com/minimal-scouser/trny

It has a method called getTransactionInfo that returns an obj containing

{
  account {type: "", no: ""}
  balance: "",
  money: "",
  typeOfTransaction: ""
}

Example:

import { getTransactionInfo } from "trny";

const message = "Dear Customer, Rs.248,759.00 is debited from A/c XXXX6791 for BillPay/Credit Card payment via Example Bank NetBanking. Call XXXXXXXX161XXX if txn not done by you";

const info = getTransactionInfo(string: string)
/*
{
    account: {type: "account", no: "6791"},
    balance: "",
    money: "248759.00",
    typeOfTransaction: "debited"
}, 
*/

It also has methods like

  1. getAccount
  2. getMoneySpent
  3. getBalance

This needs more testing but see if this solves your problem.