Wednesday, 15 April 2015

android - Card Emulation, RC522 and Nexus 4's NFC UID -



android - Card Emulation, RC522 and Nexus 4's NFC UID -

i have 2 problems:

first, want emulation card , ndef message. implemented hostapduservice using code:

public class myhostapduservice extends hostapduservice { private int messagecount = 0; @override public byte[] processcommandapdu(byte[] apdu, bundle extras) { string n1="hello world"; byte[] response=n1.getbytes(); log.d("hcedemo", "application selected"); homecoming response; } @override public void ondeactivated(int reason) { log.d("hcedemo", "deactivated: " + reason); } }

when phone emulates tag, set near nfc reader rc522. these code not run. there problem aid? used aids:

f04e66e75c02d8 f0394148148100 d2760000850101 f222222222

second, want know uid of android devices's nfc when communicate devices. nil found google :(

could help me?

the aids using okay (one should plenty though). if hce service not triggered, not issue select (by aid) command on other end. without knowing on reader-side of communication, it's pretty much impossible diagnose what's going wrong there.

note above code has nil ndef messages. if want transfer ndef messages on hce, need implement nfc forum's type 4 tag operation specification in hce service. moreover, should avoid responding arbitrary strings in processcommandapdu() method. instead should implement protocol based on iso/iec 7816-4 apdus.

regarding sec question, nexus 4 (like other hce-capabled devices) typically utilize randomly generated anti-collision identifier (uid). on devices, random id generated every activation of magnetic field of reader device (or whenever phone brought range of reader device). devices generate new id whenever screen turned on.

android nfc apdu hce

No comments:

Post a Comment