Archived:LocalDevice.isPowerOn() missing from S60 3rd Edition initial release and FP1 devices (Known Issue)
This known issue was originally created by Alanbur and has been verified by Nokia Developer.
Article Metadata
Tested with
Compatibility
Article
Contents |
Overview
The LocalDevice.isPowerOn() method is missing from the Bluetooth API (JSR-82) implementation in S60 3rd Edition and S60 3rd Edition FP1 devices.
Description
The LocalDevice.isPowerOn() method is part of JSR-82. The method is, however, missing from the API implementations in S60 3rd Edition and S60 3rd Edition, FP1 devices. This method was added in the maintenance release of the API, BT API 1.1.
How to reproduce
Use LocalDevice.isPowerOn() in your code:
try
{
LocalDevice ld = LocalDevice.getLocalDevice();
boolean power = ld.isPowerOn();
} catch (BluetoothStateException ex) {
ex.printStackTrace();
}
This will throw a java.lang.Error.
Solution
In devices compliant with the MSA Subset (JSR-248), that is S60 3rd Edition FP2 and newer devices, the version of the Bluetooth API can be queried by using the system property "bluetooth.api.version". Version 1.1 of the Bluetooth API is implemented in S60 3rd Edition, FP2 devices. Do not use the isPowerOn() method in older devices and if you do not get the API version "1.1" by using the system property. Also note also that Bluetooth API 1.1 is implemented in Series 40 5th Edition devices (and newer).


this is not the only bug. I'm developing a J2ME that should work on S40 and S60. Both are so different. Some Exceptions are just not shown on S60. Some standard things works on S40 and emulator but not on S60... horrible!
Another work around is to get the BT address - if it throws a SecurityException BT is probably turned off.
--krisha