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:
The BlackBerry smartphone starts.
The BlackBerry smartphone loads all BlackBerry smartphone applications.
The BlackBerry smartphone loads and starts third-party applications.
The application tries to start a connection thread.
The BlackBerry smartphone tries to display a prompt to inform the BlackBerry smartphone user of a connection and to allow or disallow the connection.
The prompt does not reach the user interface(UI), and is not displayed.
The Home Screen appears.
The security check starts.
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.