NFC on Android?


I had the idea of making a Monopoly money manager that uses NFC tags, kind of like contact less credit cards.

I did some research and found the Ketai library, which appears to no longer support NFC, after both reading online and trying for myself. Every search I do leads me to this incompatible library.

Is there any other library/command that can utilize the phone’s NFC to read/write to NFC tags? Or will I have to make it less cool and have a GUI?

Thanks in Advance

@TechMaster04 ===

I have done that with Android Studio using the nfcAdapter class from Android; it s rather easy but i have to get a look to the code in order to see how to transform it for P5. with this class you can read/write/record nfc.

more details here:

Ah I see. So my only option is to use Android Studio? Or are you suggesting I use P5,js?

@TechMaster04 ===
What i say is that i have done that with AS; it does not mean it s impossible with P5; as i have told: i have to see wether i can adapt my code to P5 and i am quite sure that it s possible: i ll give a look as soon as possible. I am not at all speaking about P5JS.

Okay. Sorry I seem to have misunderstood you. Thank you so much. I am hopeful of this succeeding

@TechMaster04 === weird result: i have tried to adapt my code to processing and except some details (which can be importants) i have done that; now if i test the code with P5 it does not read the tags (though the nfc is activated and running) but when i export to android and use exactly the same code inside AS it runs as expected and read the tags; as for now i cannot understand that…But i ll try because it’s absolutely abnormal.

That is very weird. I have begun to clear up space on my SSD in the event that i will need to use Android Studio (I literally only have 500 mb left :sweat_smile:).

I appreciate all the effort you’ve put in to this for me, and wish you the best of luck. If you need any help debugging, I can try to help :smiley:

@TechMaster04 ===
Ok; now it works and i can understand which was the problem though there is some kind of bug with P5; in my code i have to call the MainActivity.class, which is not recognized (because it’s a class, not. java) and P5 does not accept, in the ide it fires an error “class not recognized”; yesterday i was there and today i thought "let us see what happens, despite of the red “not recognized”… suspense: it compiles as with AS and everything is ok…And why AS does not fire this error? that is simple: i have imported the android folder from P5 && inside it there are the compiled class…and the main one… Easy??? @noel === if you are ok i can send the running code for your repo, tag ‘nfc read/write’, i have only to add that i have found solutions for ndef tags but not any for tech: is s solved with xml inside AS.

1 Like

Yes, thanks, and please, feel free to modify anything you want. I will be grateful.

Quite the intricate issue indeed. Congratulations on debugging it!