Check if you have the Bluetooth Classic / LE on your android device with Delphi
By XE7 version of Delphi components are available to manage Bluetooth Classic and LE. With FireMonkey is quite simple also create a bluetooth server. Trying my applications on Raspberry PI3 where Federico mounted Marshmallow I am aware that if BT is not available on the device the app crashed.
To overcome this problem I tried the Java API that would allow me to check if it actually was available on the BT device and it was a lot easier than you thought.
Through Androidapi.Helpers library can test whether any feature / device is available on the device being used by the command.
“SharedActivityContext.getPackageManager (). HasSystemFeature (StringToJString ( ‘
The list of testable devices is available on the documentation of Google at: http://developer.android.com/reference/android/content/pm/PackageManager.html#FEATURE_BLUETOOTH
1 2 3 4 5 6 7 8 9 10 11 |
uses Androidapi.Helpers; function isBlueToothSupported : Boolean; Begin {$IFDEF ANDROID} // Result := SharedActivityContext.getPackageManager().hasSystemFeature(StringToJString('FEATURE_BLUETOOTH')); Result := SharedActivityContext.getPackageManager().hasSystemFeature(StringToJString('android.hardware.bluetooth')); {$ELSE} Result := True; {$ENDIF} End; |