When the application calls a Bluetooth API method that requires Bluetooth to be switched on, the API implementation checks if the Bluetooth power state is off, and, if it is, prompts the user with a dialog asking if Bluetooth should be switched on. If the user chooses not to switch Bluetooth on, the API method call throws javax.bluetooth.BluetoothStateException.
The Bluetooth power state check is made in the following API methods:
javax.microedition.io.Connector.open for btl2cap, btspp, and btgoep protocols (both client and server connections)
javax.bluetooth.DiscoveryAgent
startInquiry
selectService
searchServices
javax.bluetooth.LocalDevice
getLocalDevice
All non-static methods except getDiscoveryAgent
javax.bluetooth.RemoteDevice
getFriendlyName
authorize
javax.bluetooth.ServiceRecord
getConnectionURL
populateRecord
javax.bluetooth.L2CAPConnectionNotifier
acceptAndOpen
javax.obex.SessionNotifier
acceptAndOpen