Turn on BlackBerry Smartphone Simulator security
By default, the BlackBerry® Smartphone Simulator does not check for required code signatures, and it does not prompt the user before starting a network connection. Before you deploy your application, test your application with security mode turned on in the BlackBerry Smartphone Simulator.
When you turn on security in the BlackBerry Smartphone Simulator, you cannot use the unsigned .cod files that are provided with the BlackBerry® JDE. You must use .cod files that are installed on the actual BlackBerry device.
Note: If you try to run the BlackBerry Smartphone Simulator in secure mode with unsigned .cod files, a device error 561 occurs.
Obtain signed .cod files
- Create a new folder at the same level as the BlackBerry® Smartphone Simulator folder. For example:
C:\Program Files\Research In Motion\BlackBerry JDE 4.7.0\securesim
- In the BlackBerry® IDE, on the Edit menu, click Preferences.
- Click the Simulator tab.
- Click the Advanced tab.
- In the Working directory field, type the path to the folder that you created in step 1, relative to the ide.bat file in the bin folder. For example:
C:\Program Files\Research In Motion\BlackBerry JDE 4.7.0\bin\..\securesim.
- Install the .cod files provided by your network operator or service provider.
- Move to the folder where the BlackBerry device .cod files are installed. By default, .cod files are installed in the following location:
C:\Program Files\Common Files\Research In Motion\Shared\Loader Files\Handheld\Java.
- Copy the contents of the Java® folder into the folder that you created in step 1.
- Download the .debug files for the appropriate BlackBerry device build version from the BlackBerry Developer Zone and copy them into the folder that you created in step 1.
- Restart the BlackBerry JDE.
Approve HTTP connections
The BlackBerry device includes built-in security to prevent third-party applications from sending or receiving data without the user's knowledge. When a third-party application attempts to open a connection, a dialog box prompts the BlackBerry device user to turn the connection on or off. To test this functionality on the BlackBerry® Smartphone Simulator, turn on the BlackBerry Smartphone Simulator's security function.
This security feature causes network applications to hang if HTTP connections are attempted on the main thread.
When the main thread handles connection requests, the UI cannot initiate a dialog box to prompt the user to approve the connection attempt. The application is deadlocked because the connection request cannot be completed until the user approves it.
To resolve this issue, you must put the network connection request on a separate thread from the main thread so that it does not interfere with the main thread's process.
Related topic