2

I'm developing an NFC library for Android devices. On some Android devices the data that have sent works correctly and I get healthy response (like an LG phone), but it doesn't work on some other devices (like an Oppo phone).

It's for a passport and ID card reader with ICAO standards.

example command I send in hex: 0082000028523A9AE020BF2B637771344671E7A444DABDE99BBE84835F5B1552963D69623B3DD77D609A3A22E628

It returns a data + 0x9000 as result.

I have a few set of steps till I send this command:

  • 0x00, 0xA4, 0x04, 0x0C, 0x07, 0xA0, 0x00, 0x00, 0x02, 0x47, 0x10, 0x01
  • 0x00, 0x84, 0x00, 0x00, 0x08
  • 3rd step is the command causes the error

on Oppo phone I receive 0x6A88 as an error code.

I've checked log cat from Oppo

2021-07-26 15:11:51.982 994-4950/? D/NxpTml: PN54X - Write requested.....
2021-07-26 15:11:51.982 994-4950/? D/NxpTml: PN54X - Invoking I2C Write.....
2021-07-26 15:11:51.985 994-4949/? D/NxpTml: PN54X - I2C Read successful.....
2021-07-26 15:11:51.985 994-4949/? D/NxpTml: Delay Read if write thread is busy
2021-07-26 15:11:51.985 994-4950/? D/NxpNciX: len =  49 > 00002E0082000028523A9AE020BF2B637771344671E7A444DABDE99BBE84835F5B1552963D69623B3DD77D609A3A22E628
2021-07-26 15:11:51.985 994-4950/? D/NxpTml: PN54X - I2C Write successful.....
2021-07-26 15:11:51.985 994-4950/? D/NxpTml: PN54X - Posting Fresh Write message.....
2021-07-26 15:11:51.985 994-4950/? D/NxpTml: PN54X - Tml Writer Thread Running................

I worked with same Android versions of 2 different devices, it was okay.

I actually don't have how any idea to find out what is the point I am missing. I'm totally open to any suggestions. (Like is it related the size of the data that I send and should I add a set of rules to manifest?)

Thanks!

=======================

Edit: I've added my NFCAdapter settings

        val adapter = NfcAdapter.getDefaultAdapter(this)
        if (adapter != null) {
            val intent = Intent(applicationContext, this.javaClass)
            intent.flags = Intent.FLAG_ACTIVITY_SINGLE_TOP
            val pendingIntent =
                PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT)
            val filter = arrayOf(arrayOf("android.nfc.tech.IsoDep"))
            adapter.enableForegroundDispatch(this, pendingIntent, null, filter)
        }

Right now I'm trying to add enableReaderMode to adapter. When I add it cannot discover my tag currently. I'll update my status asap.

  • Are you sure that you're getting the status word `6A88` for the EXTERNAL AUTHENTICATE command (`00 82 00 00 28 ...`)? I thought that status meant "Referenced data not found", which seems like a really odd response for that command. How are you setting up the `NfcAdapter` for communication? Have you tried using `enableReaderMode` with the `FLAG_READER_SKIP_NDEF_CHECK` flag set? – Michael Jul 26 '21 at 14:27
  • It would be easier to help if you showed your code that has the problem. – Andrew Jul 26 '21 at 16:35
  • I've added NFCAdapter setting to the bottom of question. – MK MarineBoy Jul 27 '21 at 06:44
  • _"I'm trying to add enableReaderMode to adapter. When I add it cannot discover my tag"_. You haven't shown us exactly what you're doing. Note that to be able to communicate with eMRTDs you will have to add the flag `FLAG_READER_NFC_B`, and possibly also `FLAG_READER_NFC_A`. – Michael Jul 27 '21 at 08:03

0 Answers0