开发者

How can I create mock tags to test with NFC?

开发者 https://www.devze.com 2023-02-22 05:50 出处:网络
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 messag

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消