Android 6 MIUI
ни стандартные примеры не работают, ни попытки что-то свое создать...
LastDiscoveredDevices - всегда 0, хотя из настроек устройства находятся.
unit Unit1;
interface
uses
System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs,
System.Bluetooth, System.Bluetooth.Components, FMX.Controls.Presentation,
FMX.StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Bluetooth1: TBluetooth;
Label1: TLabel;
AniIndicator1: TAniIndicator;
procedure Button1Click(Sender: TObject);
procedure Bluetooth1DiscoverableEnd(const Sender: TObject);
procedure Bluetooth1DiscoveryEnd(const Sender: TObject;
const ADeviceList: TBluetoothDeviceList);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.fmx}
procedure TForm1.Bluetooth1DiscoverableEnd(const Sender: TObject);
begin
Label1.Text := IntToStr(Bluetooth1.LastDiscoveredDevices.Count);
end;
procedure TForm1.Bluetooth1DiscoveryEnd(const Sender: TObject;
const ADeviceList: TBluetoothDeviceList);
begin
Label1.Text := IntToStr(ADeviceList.Count);
AniIndicator1.Enabled :=False;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
Bluetooth1.DiscoverDevices(10000);
AniIndicator1.Enabled :=True;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
while not Bluetooth1.Enabled do
Bluetooth1.Enabled := True;
end;
end.
В разрешениях bluetooth, bluetooth admin, coarse location, fine location включены...