The general idea is to create an app like incoming call log. So I have to create a new register in my database when a new call is answered or lost.
To do that, I implement a BroadcastReceiver that reacts when the phone state changes. In the onReceive method, I get the TelephonyManager and through this I can get the call state (getCallSate method). The problem here is that I can not know the previous state, so I can not know if an incoming call was answered or not, while if I could get the previous state, I would know it with the states transition. Maybe I could get the information that I need through the Intent (that I get in onReceive method) or through the TelephonyManager, but I do not know if it is possible. Any suggestion to do something like that? Thanks. 2010/9/8 Mark Murphy <[email protected]> > On Wed, Sep 8, 2010 at 5:55 AM, KrcK --- <[email protected]> wrote: > > So, for example, If I want to create a new register with each incoming > call > > in my database tableI should use a BroadcastReceiver, and if I want to do > > some actions in my app when appears an incoming call I should use a > listener > > (like save some states or stop a service), is ok? > > I do not completely understand what you wrote here, but I think you > have the right idea. > > > On the other hand I would like to know if is a good idea create static > > variables in a BroadCastReceiver because if I do not do it I can not know > > the duration of each answer call. > > The BroadcastReceiver will be destroyed when onReceive() is finished, > and so you have no guarantees about the lifetime of any static data > members. > > -- > Mark Murphy (a Commons Guy) > http://commonsware.com | http://github.com/commonsguy > http://commonsware.com/blog | http://twitter.com/commonsguy > > Android Training in London: http://skillsmatter.com/go/os-mobile-server > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected]<android-developers%[email protected]> > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

