I have a Gingerbread 2.3.4 powered Nexus S and I recently got some writable NFC tags. So far I can read them as blank tags, but I couldn’t find a way to write data to them.
All my research has lead me to this article: Writing tags with Nexus S from January (before 2.3.4 release).
How do you write NFC tags inside your application, using your Nexus S? Any pointers?
I found the Android NFC API text and dev guide a bit tricky to follow so a bit of example code might help here. This is actually a port of MIDP code I’ve been using in Nokia 6212 devices, so I probably haven’t yet figured out everything about Android NFC API correctly, but at least this has worked for me.
First we create an NDEF record:
Then we write the record as an NDEF message:
To write to a tag, you obviously need the Tag object, which you can get from the Intent.