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

Application stops responding when opening a connection

by BlackBerry Development Advisor ‎02-16-2010 11:28 AM - edited ‎09-16-2010 02:12 PM (2,796 Views)



This article applies to the following:

  • BlackBerry® wireless devices based on Java™



A BlackBerry smartphone has a local firewall that prevents applications from making outgoing connections unless the BlackBerry smartphone user is notified and permits the connection.

The following actions occur on a BlackBerry smartphone when an auto-start application is loaded:


  1. The BlackBerry smartphone starts.
  2. The BlackBerry smartphone loads all BlackBerry smartphone applications.
  3. The BlackBerry smartphone loads and starts third-party applications.
  4. The application tries to start a connection thread.
  5. The BlackBerry smartphone tries to display a prompt to inform the BlackBerry smartphone user of a connection and to allow or disallow the connection.
  6. The prompt does not reach the user interface(UI), and is not displayed.
  7. The Home Screen appears.
  8. The security check starts.
  9. The BlackBerry smartphone appears to stop responding.


The problem in step 9 relates to a UI conflict between the firewall screen and the security check alert window.


Make sure that the application waits to start its listening thread until after the security check is complete. The best practice is to add a section of code to the initial startup process that waits for a network connection before starting the listener thread.


To add this section of code, you can use classes in the system API library. You can use methods in the RadioInfo class to query the current state of the wireless transceiver. Invoke RadioInfo.getState() to check if the wireless transceiver is on (STATE_ON). After the wireless transceiver is active, invoke RadioInfo.getNetworkService() to determine if the BlackBerry smartphone is now ready for data service (NETWORK_SERVICE_DATA). When both requirements are met, the application can open the connection. After this section of code is executed, the firewall prompt will request access without causing the application to stop responding.

Users Online
Currently online: 23 members 911 guests
Please welcome our newest community members: