低功耗蓝牙扫描失败 [英] Scanning of Bluetooth Low Energy Fails
本文介绍了低功耗蓝牙扫描失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我目前正在开发一个将使用低功耗蓝牙的应用程序.
I am currently developing an application that will use Bluetooth Low Energy.
我正在使用以下链接,
我无法扫描周围的 BLE 设备.
I am not able to scan the surrounding BLE devices.
要扫描设备,
mBluetoothAdapter.startLeScan(mLeScanCallback);
private BluetoothAdapter.LeScanCallback mLeScanCallback = new BluetoothAdapter.LeScanCallback()
{
@Override
public void onLeScan(final BluetoothDevice device, int rssi,byte[] scanRecord)
{
runOnUiThread(new Runnable() {
@Override
public void run()
{
mLeDeviceListAdapter.addDevice(device);
mLeDeviceListAdapter.notifyDataSetChanged();
}
});
}
};
推荐答案
我遇到了同样的问题,请将这些权限添加到您的清单中
I had the same problem please add these permissions to your manifest
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
这篇关于低功耗蓝牙扫描失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文