1、隐式打开蓝牙
/*隐式打开蓝牙*/
if (!mBluetoothAdapter.isEnabled()) {
mBluetoothAdapter.enable();
}
2、弹出对话框供用户选择是否打开蓝牙
// Ensures Bluetooth is available on the device and it is enabled. If not,
// displays a dialog requesting user permission to enable Bluetooth.
if (mBluetoothAdapter == null || !mBluetoothAdapter.isEnabled()) {
Intent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
startActivityForResult(enableBtIntent, REQUEST_ENABLE_BT);
}