Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get tagId in server example? #24

Open
kryptojet opened this issue Jun 1, 2020 · 2 comments
Open

How to get tagId in server example? #24

kryptojet opened this issue Jun 1, 2020 · 2 comments

Comments

@kryptojet
Copy link

kryptojet commented Jun 1, 2020

https://github.com/skjolber/external-nfc-api/blob/master/examples/server/src/main/java/com/github/skjolber/nfc/external/MainActivity.java

private final BroadcastReceiver tagReceiver = new BroadcastReceiver() {

	public void onReceive(Context context, Intent intent) {

		String action = intent.getAction();

		Log.d(TAG, "Custom broacast receiver");

		if(intent.hasExtra(NfcAdapter.EXTRA_ID)) { // Not Working...
			byte[] id = intent.getByteArrayExtra(NfcAdapter.EXTRA_ID);
			Log.d(TAG, "Tag id " + toHexString(id));
		}

		setTagPresent(!NfcTag.ACTION_TAG_LEFT_FIELD.equals(action));
	}
};

https://github.com/skjolber/external-nfc-api/blob/master/core/src/main/java/com/github/skjolber/nfc/service/BackgroundUsbService.java

private void handleTagInitRegularMode(int slotNumber, byte[] atr, TagType tagType) throws ReaderException {
	AcsTag acsTag = new AcsTag(tagType, atr, reader, slotNumber);
	IsoDepWrapper wrapper = new ACSIsoDepWrapper(reader, slotNumber);
	Log.d(TAG, "Handle tag in regular mode " + tagType); // tagType is UNKNOWN
	...
}

What I missed?

@kryptojet
Copy link
Author

My test card tag type is 0x3B, (byte) 0x84, (byte) 0x80, 0x01, 0x00, 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x05. Is there only a way to modify the code in this case? and how to transceive data with false option?

@skjolber
Copy link
Owner

Try this setting?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants