It is important to know that the UID is transmitted at a very low level of the nfc protocol. This means that this is done regardless of the nfc firmware, and not on the Android operating system. We had the same problem in our NFCGate project and found a solution for Broadcom BCM20793 chips, such as Nexus4 / 5 chips and others, by writing the UID with NFC_SetConfig directly to the chip firmware.
You can see the working version in our github repository . Here is an unverified version to show the principle:
uint8_t cfg[] = { CFG_TYPE_UID, // config type 3, // uid length 0x0A, // uid byte 1 0x0B, // uid byte 2 0x0C // uid byte 3 }; NFC_SetConfig(sizeof(cfg), cfg);
Our tests showed that android sometimes returns a UID to a random one (length = 0, if I remember correctly), so you need to find a good place to install it when you need it, or to do something like that, as we did, and intercept NFC_SetConfig calls from android to redial our own UID.
a4c8b source share