13,864
社区成员




手机运行了app,出错,android.permission.BLUETOOTHCONNECT permission for android
这3个权限都是从Android 12系统才开始有的,
经过网上一番查找,原来是因为最近Google发布的Android 12,
新引入了 BLUETOOTH_SCAN、BLUETOOTH_CONNECT、BLUETOOTH_ADVERTISE 三个权限
Manifest.permission.BLUETOOTH_SCAN,
Manifest.permission.BLUETOOTH_ADVERTISE,
Manifest.permission.BLUETOOTH_CONNECT
C++Builder 11 如何运态申请蓝牙的这三个权限,
bool __fastcall DiscoverDevices(int ATimeout)/* overload */;
bool __fastcall DiscoverDevices(int ATimeout, System::Bluetooth::TBluetoothUUIDsList* const AList)/* overload */;
bool __fastcall DiscoverDevices(int ATimeout, GUID *AList, const int AList_High)/* overload */;
bool __fastcall DiscoverDevices(unsigned ATimeout, System::Bluetooth::TBluetoothLEScanFilterList* const ABluetoothLEScanFilterList)/* overload */;
Bluetooth::TBluetoothUUIDsList * TBluetoothUUID = "{0000180D-0000-1000-8000-00805F9B34FB}";
BluetoothLE1->DiscoverDevices(2500); //2500毫秒的查找时间
应该是上述的函数,问:有操作实际例子?
大家有用过的,请帮助...
https://docwiki.embarcadero.com/Libraries/Sydney/en/System.Bluetooth.Components.TBluetoothLE.DiscoverDevices
这个还要什么例子,调用DiscoverDevices(过滤或者不过滤),提供一个OnEndDiscoverDevices事件处理过程就可以了
这个事件触发的时候,参数中包含了发现的蓝牙设备的列表
大概从安卓7开始,敏感权限大部分都是动态权限,在安装时获得的权限,运行时还是要弹出对话框要用户授权才行。
你在Manifest文件里添加权限,运行时检查返回值(按上面的说明,windows、macos、ios总是返回true,android可能返回false,如果用户拒绝授权的话)。
Delphi 盒子论坛 问问看