//
/**
* 检查蓝牙是否连接
*/
private BroadcastReceiver mBlueToothReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if (BluetoothAdapter.ACTION_STATE_CHANGED.equals(action)) {
if (intent.getIntExtra(BluetoothAdapter.EXTRA_STATE, -1)
== BluetoothAdapter.STATE_OFF) {
Log.i("Lemon", "蓝牙设备关闭");
}
}
if (mUpdatePresenter.containsIOProcessor(NewBlueToothReceiver.SingletonHolder.INSTANCE)) {
if (BluetoothDevice.ACTION_FOUND.equals(action)) {
/**
* 找到蓝牙设备
*/
BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
NewBlueToothReceiver.SingletonHolder.INSTANCE.setCurrentAddress(device.getAddress());
}
}
}