Hallo,

the tag object's getId() method should work just fine for most
cases[1]. I.e.

byte[] uid = tagFromIntent.getId();

[1] Note that some tag platforms use random UIDs. For some others the
method may return only a partial UID. Like NFC Forum Type 1 tags,
where the method returns only 4 bytes of the 7 byte UID (which is
correct as only those 4 bytes are used to reference the tag in the
transmission protocol.)

Besides getId(), this should also work (and give the same result as
getId()):

byte[] uid = intent.getByteArrayExtra(NfcAdapter.EXTRA_ID);

br
Michael



On Aug 4, 11:32 am, "xiaodai...@163.com" <zsbitxiao...@163.com> wrote:
> Hi,
> I just started to research the NFC relevant content.
> I can scan the card, but always don't read the card UID.
>
> I want to use getId(),but it cant'n read.
> And i see some demo ,using "Tag tagFromIntent =
> intent.getParcelableExtra(NfcAdapter.EXTRA_TAG);"
> But it outputs a bunch of garbage characters.
>
> How it should be read the card UID?
>
> Can anyone help me....Thank you very much!
>
> Regards,
> Xiaoxiao

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to