I am currently trying to create an app that can track how much time I spend in a phone call and then display that on a toast message after clicking a button.
Code found here: http://paste.ideaslabs.com/show/6INd0afyi
I can't seem to figure out why the app is not working...
The idea is to create a service that starts as soon as I make a phone call (and keeps running indefinitely from then on). The Service has two while loops that track the start time and end time of the conversation using the getCallState() method through the TelephonyManager class. And then the values the end time and start time variables are stored and used in the activity class.
The activity class simply uses a button to display a toast message that says how much time I have spent.
When I try to run the app on my phone I can see the service running, but the app crashes sometimes or just shows that the time spent calling is 0 mins (which is not true..)
Hope you guys can point out any mistakes?!
Thanks!