Hello Developer, Hope you guys are doing great. Today at Tutorial Guruji Official website, we are sharing the answer of How to check the status of BlueTooth adapter (ON/OFF) with Delphi 10.3 (Firemonkey) App for both Android and iOS without wasting too much if your time.
The question is published on by Tutorial Guruji team.
The question is published on by Tutorial Guruji team.
I am writing an IOT based (BLE) Firemonkey app and I need to check that Bluetooth adapter is Enabled or not for both iOS and Android.
I’ve found a source here but it is only for android (like many others), but I need a cross platform solution.
Answer
I’ve found a proper solution on here.
uses System.Bluetooth; function IsBluetoothLEAdapterEnabled: Boolean; var manager: TBluetoothLEManager; adapt: TBluetoothLEAdapter; begin Result := False; try manager := TBluetoothLEManager.CreateInstance; except exit; end; try adapt := manager.CurrentAdapter; except exit; end; try if adapt.State = TBluetoothAdapterState.On then begin // BluetoothLE Adapter was found Result := True; exit; end; except exit; end; end;
end execute like below
if IsBluetoothLEAdapterEnabled then ShowMessage('BluetoothLE ON') else ShowMessage('BluetoothLE OFF');
We are here to answer your question about How to check the status of BlueTooth adapter (ON/OFF) with Delphi 10.3 (Firemonkey) App for both Android and iOS - If you find the proper solution, please don't forgot to share this with your team members.