源码地址
普通蓝牙:
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
if (mBluetoothAdapter == null) {
return;
}
if (!mBluetoothAdapter.isEnabled()) {
mBluetoothAdapter.enable();
}
IntentFilter intent = new IntentFilter()
intent.addAction(BluetoothDevice.ACTION_FOUND)
intent.addAction(BluetoothDevice.ACTION_BOND_STATE_CHANGED)
intent.addAction(BluetoothAdapter.ACTION_SCAN_MODE_CHANGED)
intent.addAction(BluetoothAdapter.ACTION_STATE_CHANGED)
intent.addAction(BluetoothAdapter.ACTION