android打开关闭蓝牙和wifi

蓝牙

获取系统蓝牙服务:
BluetoothAdapter mBluetoothAdapter = BluetoothAdapter
.getDefaultAdapter();
打开:mBluetoothAdapter.enable();
关闭:mBluetoothAdapter.disable();

wifi

获取系统wifi服务
WifiManager wifiManager = (WifiManager) context
.getSystemService(Context.WIFI_SERVICE);
打开:wifiManager.setWifiEnabled(true);
关闭:wifiManager.setWifiEnabled(false);

你可能感兴趣的:(android移动开发)