franckbour / Plugin.NFC

A Cross-Platform NFC (Near Field Communication) plugin to easily read and write NFC tags in your application.
MIT License
235 stars 68 forks source link

Tag is not NDEF compliant when publishing #153

Open RsZoli opened 1 week ago

RsZoli commented 1 week ago

Description

I'd like to "digitize" a simple printer card, when i read it it really barely has anything on it:

image

When i try to publish this read data i got the "Tag is not NDEF compliant" exception. This is my code:

var tag = new TagInfo(_readCard.Identifier)
{
    Records =
    [
        new NFCNdefRecord
        {
            TypeFormat = NFCNdefTypeFormat.Mime,
            MimeType = "application/hu.rszoli.nfctest",
            Payload =_readCard.Identifier
        }
    ]
};

try
{
    CrossNFC.Current.PublishMessage(tag);
}
catch (Exception ex)
{
    await Toast.Make(ex.Message, ToastDuration.Short).Show();
}

What am i missing? I do not care any data but the Identifier read off the card, but i do not mind if its NDEF formatted, i just do not understand how to do this!

Steps to Reproduce

  1. Follow above...

Expected Behavior

Publish a tag with a single Identifier and nothing else on it

Actual Behavior

Tag is not NDEF compliant

Basic Information

Screenshots

Reproduction Link

FaithfulDev commented 1 day ago

I have little experience with this plugin, so this is just a random guess: Doesn't it say IsWritable = false? I would assume that means it was locked and can't be written to anymore.

tentom commented 20 hours ago

In addition to what FaithfulDev said it also says IsSupported = false so I would assume that it is not supported?

RsZoli commented 20 hours ago

Thank you for your response! That is the data from the card that i have successfully read! I only need SerialNumber, nothing else, so the rest is irrelevant! I want to present the data to a NFC reader using my phone, instead of the card itself!