04-13-2010 10:51 AM
Just a small guide to make answering the many questions about phone listeners easier, for me to bookmark and link to it.
You can either extend
do this in an own class to improve the readability of your code.
do not do any heavy processing, best no processing at all.
code in the phonelistener is executed in the context of the phone application. that means getUiApplication will return the phone application, not your own. If you use Thread.sleep you halt the phone app and can even kill it (it will be restarted automatically by a watcher process).
I suggest to use global events to move the processing to your own application. define some GUIDs for the events and implement a globaleventlistener in another class in your app. you can provide the callID as a parameter on the event to retain all information.
If you do any heavy processing, like looking up or adding contacts in the local addressbook, network related stuff, parsing of any kind etc: Use a dedicated thread for it, even after moving the processing to the global event listener.