我有BroadcastReceiver
正在抓捕ACTION_PAIRING_REQUEST
。
final IntentFilter filter = new IntentFilter(BluetoothDevice.ACTION_PAIRING_REQUEST);
registrar.activeContext().registerReceiver(pairingRequestReceiver, filter);
我的广播接收器如下:
final private BroadcastReceiver pairingRequestReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
switch (intent.getAction()) {
case BluetoothDevice.ACTION_PAIRING_REQUEST:
final BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
final int pairingVariant = intent.getIntExtra(BluetoothDevice.EXTRA_PAIRING_VARIANT, BluetoothDevice.ERROR);
Log.d(TAG, "Pairing request (variant " + pairingVariant + ") incoming from " + device.getAddress());
//...
default:
break;
}
}
};
问题是,注册接收者总是会阻止Android显示默认的系统配对对话框。
正常吗?只有abortBroadcast
才能阻止该对话框...
我现在该怎么办?像“转播”一样?
任何帮助将不胜感激。