Hallo Zhihong,

> [...] I write the tag by Ndef class, but the tag can't be read by any
> readers application, it cause them crash.
> [...]
> NdefRecord record = new NdefRecord(
>       NdefRecord.TNF_WELL_KNOWN,
>       NdefRecord.RTD_TEXT,
>       new byte[0],
>       "this is a write tag".getBytes()
> );

Right, looking at the above statement you try to write an NDEF Text
record. Unfortunately, your payload data ("this is a write
tag".getBytes()) is simply wrong. You should have a look at the NFC
Forum's NDEF Text Record Type Definition specification[]. A text
record's payload looks like this:
+-------------+---------------+--------------------------------+
| Header Byte | Language Code |              Text              |
+-------------+---------------+--------------------------------+
So the payload starts with a header byte that defines the text encoding
and the length of the language code. It is followed by a language code
and the actual text field.

[] http://www.nfc-forum.org/specs/spec_list/#text_rtd

br,
Michael

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to