Cannot get RFID reader to read tags.

// Expert user has replied.
R Robert Harrington 3 years 6 months ago
202 1 0

EDIT: Sorry, in the title I meant: Cannot get *UHF* reader to read tags.
Hi there, I needed some help with the android sdk .
What I am trying to do is simply start scanning (I don't need to apply filters or anything like that), and store the scanned tags in an arraylist or something similar.
(ideally I should be able to use the trigger/gun of the handheld reader device, but that's probably not relevant to this thread.
Anyways, I created a class called EventHandler that implements RfidEventsListener.
Inside of it there's the eventReadNotify method that as a parameter has RfidReadEvents.
code:
```
class EventHandler implements RfidEventsListener {
// Read Event Notification
public void eventReadNotify(RfidReadEvents e) {
TagData tag = e.getReadEventData().tagData;
if (tag.getOpCode() == ACCESS_OPERATION_CODE.ACCESS_OPERATION_READ
&& tag.getOpStatus() == ACCESS_OPERATION_STATUS.ACCESS_SUCCESS) {
Log.d("Main Activity", "eventReadNotify - tag id " + tag.getTagID() + " and mem bank " + tag.getMemoryBankData());
}
}
@Override
public void eventStatusNotify(RfidStatusEvents rfidStatusEvents) {
}
}
```
when I actually call the function in the MainActivity I don't know what to pass inside the eventReadNotify method. I know that it expects an RfidReadEvents, but I don't know how to initialize it.
There's no mention of it in the documentation and I tried to do a lot of research the past few days online, but couldn't find anything useful.
I also tried another code for the eventReadNotify method that I found somewhere online, it looks like this:
```
public void eventReadNotify() {
myTags = MainActivity.reader.Actions.getReadTags(100);
if (myTags != null) {
for (TagData myTag : myTags) {
Log.d("MainActivity", "Tag ID " + myTag.getTagID());
}
}
}
```
With the latter one, if I go into debug mode, I can see that myTags is always null.
I attached a copy of my code down (sorry if the code is a mess, I'll have to fix that but I'm just trying to get things done first);
So if I could get help with that, it would be great, otherwise if there's any other way to read tags and store their ID it would be good as well.
At the moment we are using a mc3300r for testing and developing.
Many thanks in advance for your help!

Please Register or Login to post a reply

1 Replies

J James Swinton-Bland

Hi Robert,
I'd recommend testing our sample application here: https://techdocs.zebra.com/dcs/rfid/android/2-15/samples/hellorfid/ 
From a quick look at your source code you need to populate the code inside the eventReadNotify callback on line 139/140 with the code required to validate and store the RFIDReadEvent, something like:

/**
* Untested
*/

RfidEventsListener eventHandler = new RfidEventsListener() {
@Override
public void eventReadNotify(RfidReadEvents rfidReadEvents) {
e.getReadEventData().getTagID();
}

@Override
public void eventStatusNotify(RfidStatusEvents rfidStatusEvents) {

}
}; 

CONTACT
Can’t find what you’re looking for?