unr
unr

Reputation: 43

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 special start/end byte, is it true?

Upvotes: 2

Views: 1247

Answers (2)

ThomasRS
ThomasRS

Reputation: 8287

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.

Upvotes: 1

Sven Haiges
Sven Haiges

Reputation: 2636

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.

Upvotes: 0

Related Questions