Search code examples
javadetectionblackberry-simulator

check for blackberry simulator in code


Is there any way to detect in java code whether or not the code is running on a blackberry simulator or on a real device? I have to set a connection string based on whether its running on the simulator or on the real device and would like to set that automatically...


Solution

  • Call DeviceInfo.isSimulator(), this is found in net.rim.device.api.system. See http://www.blackberry.com/developers/docs/4.0.2api/net/rim/device/api/system/DeviceInfo.html for the class details.