Tabibito wrote: > I'm a total newbie to Android (and to Java in general... mostly a PERL/ > PHP guy here...), so forgive me if I use the wrong terminology to > refer to things... I have been asked by my company to implement an > application for Android that allows a user to enter a note at the end > of every call. E.g., either they or the other party hangs up, > immediately a notes area pops up with a "save" button and if they > enter a note, the note is saved with a reference to the call log > entry. As I understand it, onCallStateChange() will give a pretty > good indicator of a hangup if the state has become > TelephonyManager.CALL_STATE_IDLE. I've figured out how to do the UI > part, how to save it in a database, etc... My question, however, is > about how I implement this "listening" aspect of it. > > Should I have a service running all the time that has an instance of > android.telephony.PhoneStateListener?
Unfortunately, yes. I really wish there were broadcast Intents for this. > If so, do I use the onBind or > onStart method Probably onStart(), and probably triggered by a BroadcastReceiver set up to run when the phone gets booted, I would imagine. You can find an example of setting up an on-boot BroadcastReceiver here: http://github.com/commonsguy/cw-advandroid/tree/master/SystemEvents/OnBoot/ > and how do I make sure it doesn't go away when memory > runs low? You can't, though Android is supposed to restart your service in this case, once memory has freed up. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Android App Developer Books: http://commonsware.com/books -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en