Android Question NFCV for 15693 I can't use ndef

drgottjr

Expert
Licensed User
Longtime User
 
Upvote 0
I've been using that amazing search engine all day. But the information found aren't clear for a beginner. I will try some suggestions received from my collegue.
 
Upvote 0

drgottjr

Expert
Licensed User
Longtime User
I've been using that amazing search engine all day. But the information found aren't clear for a beginner. I will try some suggestions received from my collegue.
android's support for non-ndef-formatted tags is basic. this is not an ideal first project.
the nfc library has a runasync() method which allows you to communicate (via transceive) with non-ndef tags
an example is shown in one of the search engine's hits: https://www.b4x.com/android/forum/threads/reading-nfcv-tag-iso15693.139679/

what, exactly, have you done so far? post your code. if you know how to talk to type 5 tags, all you have to do with b4a is discover them,
connect and run your async command.

because of android's support of ndef, everything is handled in the nfc library. not so with non-ndef tags. b4a will get you connected, but you're on your own after that (that is, you talk to the tag with runasynch()). this, by the way, has nothing to do with some shortcoming on the part of b4a. if you were coding in java or kotlin with android studio, you find the same situation. android only gives you transceive for non-ndef. b4a gives you transceive through runasynch. otherwise you would have to create a background thread to do the transceive.
 
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
I've been using that amazing search engine all day. But the information found aren't clear for a beginner. I will try some suggestions received from my collegue.
one of its amazing capabilities is exactly the one pointed out by @drgottjr, once you place a questions (create a thread) a bunch of related threads are listed just under it!
I didn't mean you didn't use it, I just ment that most don't even realize how well it works
 
Upvote 0
Thank you at all for the help.

For my project I am forced to use async because I have to read and write a st25dv for which there is a specific sdk that I use for reference. In this memory I have to read and write data that are protected by password and crc. We chose B4A because there is already a software for windows written in Visual Basic that we already.

This is wath I'm doing.

Private Sub B4XPage_Appear
nfc.EnableForegroundDispatch
Dim si As Intent = B4XPages.GetNativeParent(Me).GetStartingIntent

If si.IsInitialized = False Or si = prevIntent Then Return
prevIntent = si
Dim jo As JavaObject = TagTech
Dim tag As JavaObject = jo.RunMethod("getTag", Null)
Dim rawId() As Byte = tag.RunMethod("getId", Null)
Log(bc.HexFromBytes(rawId)) 'bc = ByteConverter
If si.Action.EndsWith("TECH_DISCOVERED") Or si.Action.EndsWith("NDEF_DISCOVERED") Or si.Action.EndsWith("TAG_DISCOVERED") Then
Dim techs As List = nfc.GetTechList(si)
Log($"Techs: ${techs}"$)
'in this case we are only accessing NfcV tags.
If techs.IndexOf("android.nfc.tech.NfcV") > -1 Then
TagTech.Initialize("TagTech", "android.nfc.tech.NfcV" , si)
'Connect to the tag
TagTech.Connect
TagTech.RunAsync("TT", "transceive", Array(Array As Byte(0x10,0,0,0xb0,0xFF)), 0)
Wait For TT_RunAsync (Flag As Int, Success As Boolean, Result As Object)
Else
toast.Show("Tag does not supported.")
End If
End If
End Sub
 
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
please use to encapsulate your code when posting, it will make it easier to read.
 
Upvote 0

Similar Threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…