Custom (NFC) NDEF format
I would like to transport over the LLCP a custom data within the NDEF message in one NDEF record (or possibly the payload will be chunked across several NDEF records). The transported content is a file with a specific format that has meaning only in specific application. So, what is the best approach for specifying the NDEF header?
1) Set TNF to 0x04 (NFC Forum External Type), 0x03 (Absolute URI) or 0x05 (Unknown)? The 0x04 will have in the TYPE field custom relative URI and in the case of 0x03 absolute URI. The 0x05 I do not like much, since the receiving device cannot identify the application for processing data, because the TYPE must be empty in that case (here only the ID field can help).
2) The ID field is for the NDEF message uniqueness, so can be either empty or will contain the custom identifier in a form eg com.company.nfc.application_name&id=message_generated_uuid
My opinion is - use of the TNF 0x03 or 0x04 is a preferred way, with leaving the ID empty unless the messages will need some additional identification, which will be better to transport outside of the payload.
BR STeN
If your app will have to work also with Android 2.3 Gingerbread and potentially other platforms, I would recommend using your own defined a MIME type (TNF field set to 0x02).
Android 2.3 does not support External Type, so I would not recommend that. Using Unknown type will not help in identifying the payload and/or app to be used. Absolute URI type is treated by Android the same as the well-known type URI RTD "U", so that may potentially cause confusion. I am not aware of any platform that will use the ID field to identify the app to be used.
You can also add an Android Application Record at the end of your message, containing your app's package name. On Android 4 ICS this will give precedence to your app over any other potential matches based on the NDEF message type.
链接地址: http://www.djcxy.com/p/70140.html上一篇: 如何使用MIFARE 1k classic在多个块中编写NDEF记录?
下一篇: 自定义(NFC)NDEF格式