Android 蓝牙开关:打开和关闭蓝牙
打开蓝牙:
BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
if (!bluetoothAdapter.isEnabled()) {
bluetoothAdapter.enable();
}
关闭蓝牙:
BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
if (bluetoothAdapter.isEnabled()) {
bluetoothAdapter.disable();
}
原文地址: https://www.cveoy.top/t/topic/oIZu 著作权归作者所有。请勿转载和采集!