打开蓝牙:

BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
if (!bluetoothAdapter.isEnabled()) {
    bluetoothAdapter.enable();
}

关闭蓝牙:

BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
if (bluetoothAdapter.isEnabled()) {
    bluetoothAdapter.disable();
}
Android 蓝牙开关:打开和关闭蓝牙

原文地址: https://www.cveoy.top/t/topic/oIZu 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录