read tag UID of a classic mifare 1k or NFC

abcroverix

Member
Licensed User
Longtime User
Hello, I'm new in java and android programming.
I need to read the classic mifare 1k or NFC UID
I tried to use the NFC.GeTagtUID from NFC library 1.1 (posted by Sherlock)
I get an array of 4 bytes. First two bytes are the same to the first two byte of the UID (I can read the UID with another device), but the last two bytes are negative numbers and are wrong.

This is the piece of my code:

If NFC.IsNdefIntent(Activity.GetStartingIntent) Then
Dim XID(20) As Byte
XID=NFC.GeTagtUID(Activity.GetStartingIntent)
end if

For example the last two bytes I get are (in decimal): -54,-73,
but the last two bytes in the UID are (in hex): CA, B7.

Someone can explain to me because this happen?
Where I'm wrong?

Many thanks

Fabio
 

Rafal Galewski

Member
Licensed User
Longtime User
Problem with If NFC.IsNdefIntent(Activity.GetStartingIntent) Then

Could You share me Your project.
I have a problem with Intent activity.
I want read UID from Mifare 1 K but I have a problem with NFC.IsNdefIntent.
I don't have any success read UID number.

Please help I 'm new in Android apps.

:sign0013:
Thank You advance.
 
Upvote 0

Rafal Galewski

Member
Licensed User
Longtime User
If NFC.IsNdefIntent(Activity.GetStartingIntent) Then


XID=NFC.GeTagtUID(Activity.GetStartingIntent)


ByteConverter.StringFromBytes(XID,ID)


ToastMessageShow(ID,True)


"If NFC.IsNdefIntent(Activity.GetStartingIntent) Then"
- Never go to IF section, becouse in my opinion start BALayout program debuger and Intent started is MBALayout not my .


:sign0163:
 
Upvote 0

Rafal Galewski

Member
Licensed User
Longtime User
It will be an "ndef intent" when you scan such tag.


Yes , I check by IF ndef intent.

But I have to change something in Manifest file ?

Now is like this:

AddActivityText(main, <intent-filter>
<action android:name="android.nfc.action.NDEF_DISCOVERED"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:mimeType="text/plain" />
</intent-filter>)




Please write for me more details.

;)

Thank You
 
Upvote 0

Rafal Galewski

Member
Licensed User
Longtime User
Problem on Android 4.1.1

I do this in another way on 4.0.4 android.
But now I try to use it on 4.1.1 Android
And this now work correctly.

No UID is read

When I read UID tag Layout - all activity is change position.

What is problem - library ?

How resolve this problem
 
Upvote 0

Rafal Galewski

Member
Licensed User
Longtime User
Thank You I try.
When can I read this LOG.

In debugger ?


I update phone from android 4.0.4 to 4.1.1
In my opinion is problem with Mifare classic read UID.
 
Upvote 0

Rafal Galewski

Member
Licensed User
Longtime User
No I don't have to write Mifare 1k becouse is serial number from chip.
yesterday I correct read serial number - UID.

But when I change version from android 4.0.4 to android 4.1.1 - this function can't work correctly.

I use library NFC 1.1 - with UID read function
 
Upvote 0

Rafal Galewski

Member
Licensed User
Longtime User
I check which intents your activity receives:

(Intent) Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 pkg=de.mrsoft.xnfc cmp=de.mrsoft.xnfc/.main }

no extras
 
Last edited:
Upvote 0

Rafal Galewski

Member
Licensed User
Longtime User
Scanning an NFC tag without a ndef record results in null pointer exception android

In android 4.1.1 - Scanning an NFC tag without a ndef record results in null pointer exception android

correct behaviour:
unformatted tags should be considered as such and not lead to an npe.


Worked correctly in 4.0.4.
 
Upvote 0

Rafal Galewski

Member
Licensed User
Longtime User
Thank You Erel,

When I use write TAG Mifare Classic with text data.
Data are correct reading but screen flickers.
When drawing shows the effect of light on the new.


When I use not formatted tag Mifare Classic , only want read UID - serial number tag in null pointer exception android.
I can't read UID serial number TAG.
This function correctly work on android 4.0.4 .
What is changes ?
When I use another software for example by NXP - correctly read UID .

PLease send to me on my email sample code working in You using UID and also using ndef recor.

Thank You for all.

Please help.
 
Upvote 0
Top