Plugin.NFC icon indicating copy to clipboard operation
Plugin.NFC copied to clipboard

Add support for Mifare NFC tags

Open jerryvanechelpoel opened this issue 4 years ago • 7 comments

Description

The TagInfo does not contain data when scanning a MifareClassic NFC.

Steps to Reproduce

Scan a MifareClassic NFC by using the OnMessageReceived event

Expected Behavior

The Records property should contain data.

Actual Behavior

The Records property is null

Basic Information

  • Version with issue: 0.1.14
  • Last known good version: Unknown
  • IDE: Visual Studio 2019
  • Platform Target Frameworks: .NET Standard 2.0
    • iOS: n/a
    • Android: 9
    • UWP: n/a
  • Nuget Packages:
  • Affected Devices: Samsuns S9, OnePlus 3T, OnePlus 6T

Screenshots

afbeelding

Reproduction Link

n/a

jerryvanechelpoel avatar Feb 27 '20 09:02 jerryvanechelpoel

Any idea is Mifare Classic tag identifier (the CSN) is being returned (even if the payload record isn't) ?

zizusoft avatar Apr 04 '20 23:04 zizusoft

I believe it did. What I noticed is that tag is detected, but the payload is not read out. I tried NFC Tools to make sure that the tag contains data, and it dit, so it must be clearly something in this library.

jerryvanechelpoel avatar Apr 06 '20 08:04 jerryvanechelpoel

I have two MifareClassic 1k tags and its works fine.

The available technologies of your tag should be NfcA, MifareClassic, Ndef. If you have NdefFormatable instead of Ndef, your need to format the tag before using this plugin.

image

franckbour avatar Apr 23 '20 18:04 franckbour

Well that's exactly what I said: NFC Tools detects the data, but Plugin.NFC just isn't able to read the data from the tag and show it to the consuming code.

jerryvanechelpoel avatar Apr 23 '20 18:04 jerryvanechelpoel

Then i need more information. Like I just said, i tested with two differents tags and it works fine, data and serial number are read. What technologies are used in your tag and what kind of data is stored ?

franckbour avatar Apr 23 '20 18:04 franckbour

In order to support mifare classic on android, check here, for mifare desfire you need to read from isodep

twsl avatar May 16 '20 02:05 twsl

Hi,

I had the same issue. And the problem came from the format method line 248

In the NFC.android.cs file,

Add an else and this code. It worked perfectly for me. And I was not able to do it with the original code.

NdefFormatable ndefFormatable = NdefFormatable.Get(_currentTag); if (ndefFormatable != null && clearMessage) { // initialize tag with new NDEF message try { ndefFormatable.Connect(); ndefFormatable.Format(null); } finally { try { ndefFormatable.Close(); } catch (Exception e) { isnull = true; } } }

dalton5 avatar Jan 02 '21 19:01 dalton5