【发布时间】:2014-04-26 18:57:13
【问题描述】:
我正在关注低功耗蓝牙设备的文档以扫描 BLE 设备。
如文档中所述,我定义了 ---
BluetoothAdapter mBluetoothAdapter = null;
final BluetoothManager bluetoothManager =
(BluetoothManager) getSystemService(Context.BLUETOOTH_SERVICE);
mBluetoothAdapter = bluetoothManager.getAdapter(); //Lint Error..
但是我收到了一个 Lint 错误---
调用需要 API 级别 18(当前最低为 8): android.bluetooth.BluetoothManager#getAdapter
所以我将代码更改为--
mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
上面的 lint 错误的代码替换了吗?
【问题讨论】:
-
目前安卓只支持一个蓝牙适配器,所以你可以用
BluetoothManager.getAdapter() -
你的意思是我可以用-
BluetoothAdapter.getDefaultAdapter()? -
当然可以,但现在没有意义,因为上面的原因
标签: android bluetooth-lowenergy android-bluetooth