I have an Android tablet with Android 4.2. This tablet does not have NFC hardware. However I have an external USB reader: ACR 1252U, that came with an Android library. I have asked some general questions of my setup here. Now that it gets more specific, I need to ask another one. In this previous question I found out, that I can use the ACS Android library to access the readers card emulation capabilities.
My first goal is to make that reader emulate an NFC tag, that contains a URL. Any NFC-capable Android phone should be able to scan this emulated tag and automatically open the browser. I have tested it, and it works with a real (physical) tag. But unfortunately I am not able to emulate this tag correctly...
Now I wrote an Android application, but I am stuck. According to the readers API (PDF), I can get it into card emulation mode by sending the command
E0 00 00 40 03 01 00 00
When I do this, it gives me the answer:
E1 00 00 00 03 01 01 01
This confirms, that it is in card emulation mode. With an Android application I now can scan the emulated Tag, which says, that this is recognized as a "NXP MIFARE Ultralight" tag.
My problem now is, how to feed the tag with a URL. According to the reader API (section 5.10.3), I need to send the command:
E0 00 00 60 13 01 01 00 0F D1 01 0B 55 01 67 6F 6F 67 6C 65 2E 63 6F 6D
where D1 01 0B 55 01 67 6F 6F 67 6C 65 2E 63 6F 6D
is the NDEF message that contains the URL "http://www.google.com". I created this NDEF message using this Android Java code:
String target_url = "http://www.google.com";
Uri uri = Uri.parse(target_url);
NdefRecord recordNFC = NdefRecord.createUri(uri);
NdefMessage message = new NdefMessage(recordNFC);
An application on my Android phone, that reads NFC tag says the following:
As you can see, the URL is saved on the emulated tag.
- So why doesn't the browser of my phone open the url?
- Am I missing something? Are my commands wrong?
- Why are there some "?" characters?