Reputation: 1
I am trying to emulate an url tag using libnfc and a PN532 module.
The ndef file works on "GoToTags" for IOS but it doesn't on "NFC Tools" or "NFC".
If I try to background-read it in android, it will say that there's not an available app for it even if any URL tag can be opened with Chrome.
For android I am using a Redmi 9C NFC
Is there anything wrong in this definition? Could it be other thing affecting the reading?
Here's the NDEF file I am using at the moment. I commented what I think every byte means but please correct it if there's anything wrong.
uint8_t ndef_file[0xfffe] = {
0x00, //(Start Position) -> 0
32, //(End Position) -> 32 Positions after this one.
0xd1, //HEADER
0x02, //Payload Count
0x1b, //SIZE FROM 0x91 to END
0x53, 0x70,//SP
0x91, //UKNOWN
0x01, //UKNOWN
0x08, //Title Size (FROM 0x65 to 0x51)
0x54, //T
0x02, //2 bytes UTF-8
0x65, 0x6e, // Language (EN)
0x74, 0x63, 0x6b, 0x6e, 0x66, 0x63, //RcpNFC
0x01, //TNF Record Type 0x01 "NFC Forum Well-Known Type"
0x0b, //PAYLOAD SIZE FROM "URI IDENTIFIER" to END
0x55, //URI Records (0x55/'U')
0x04, // URI IDENTIFIER 0x03 http:// 0x04 https://
0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d //PAYLOAD (google.com)
};
Thank you in advance.
Edit 1: This is the code I am using to emulate the tag, even for the default code it won't work: https://github.com/nfc-tools/libnfc/blob/master/utils/nfc-emulate-forum-tag4.c
I debugged the android device and this message appears:
NativeNfcTag: Check NDEF Failed - status = 3
Here's the relevant part of the log: https://pastebin.com/zy884AMq
Upvotes: 0
Views: 374
Reputation: 1918
TL;DR Use a plain URI record, not a Smart Poster.
Native iOS does not support Smart Poster records which is a NDEF Text record (the website title) + a URI record (the website url). The reason the GoToTags app works properly is that it explicitly handles Smart Posters. We have reported bug this directly to the NFC Forum to be communicated to Apple to resolve it but that went nowhere. Smart Poster records are pointless really.
Upvotes: 0
Reputation: 10232
From the docs
To do this, the system reads the first NdefRecord inside the NdefMessage to determine how to interpret the entire NDEF message
And if you look at the source code
ndefUri = message.getRecords()[0].toUri();
It only looks at NDEF record 0
and as it looks like (I've not fully matched that method of describing NDEF data) that your first record (Record 0) in a Text
Record for which there is usually no default App installed (and it definitely won't be a web browser)
A Text
record by default usually on Android causes the System NFC App to just popup a dialog box displaying the text in the Text
Record.
This is probably different behaviour than iOS which probably ignores any records that are not URI's
Upvotes: 0