Android NFC send the data in a same way on different devices

Viewed 127

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.

0 Answers
Related