How can I create mock tags to test with NFC?
How can do i create ndef messages in byte form? I've read somewhere it need to have a spec开发者_运维问答ial start/end byte, is it true?
I have released an NFC Eclipse plugin for composing NDEF messages of various sorts, you might find it useful. It will produce binary NDEF files.
Doing the same programmatically, have a look at NFC Tools tools or (another project of mine) NDEF Tools for Android.
If you're not able to mock the Tags directly (i.e. using mockito), you can use a (another project of mine) wrapper and either mock the wrapper object directly or manipulate the service it connects to.
Not sure why you need the message in bytes, but once you created a NdefMessage you can call the toByteArray() method to return a byte array. Same is true for NdefRecord.
精彩评论