Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Posts: 17,024
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

How To use a phone listener

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


or implement



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.

feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter