BluetoothAdapter blueadapter = BluetoothAdapter.getDefaultAdapter();
if (!blueadapter.enable()) {
ToastUtils.showShort("请打开蓝牙");
return;
}
使用了FastBle库的情况下
BleManager.getInstance().init(getApplication());
if (!BleManager.getInstance().isBlueEnable()) {
ToastUtils.showShort("请打开蓝牙");
return;
}