We have an app that is used to simulate POS terminal, i.e. it communicates with debit/credit cards via NFC. In all the app activities I am using:
nfcAdapter.enableReaderMode(this,
nfcCallback,
NfcAdapter.FLAG_READER_NFC_A |
NfcAdapter.FLAG_READER_NFC_B |
NfcAdapter.FLAG_READER_NFC_F |
NfcAdapter.FLAG_READER_NFC_V |
NfcAdapter.FLAG_READER_NO_PLATFORM_SOUNDS |
NfcAdapter.FLAG_READER_SKIP_NDEF_CHECK,
null
);
in order to disable NDEF discovery because it interferes with the card communication. It works well, but ONLY in the activity, i.e. when starting new activity or finishing one that was called with startActivityForResult there is obviously this intermediate state where the OS is sending one NDEF tag discovery message like:
2018-11-14 09:07:11.794 802-3109/? D/NxpNciX: len = 16 > 00000D00A4040007D276000085010100
2018-11-14 09:07:11.794 802-3109/? D/NxpTml: PN54X - I2C Write successful.....
The main problem is that this is not repeatable, i.e. sometimes it happens, sometimes not. This is a big problem.
Is there a way to disable the NDEF tag discovery on app level, not just for activity?
OR
Is there a workaround for this problem?