NFC Mifare UID (Card Serial Number) reverse issue in Android

If you are using NFC (Near Field Communication) Mifare in your application, you should be careful while using NFC Mifare UID 
(Unique IDentification also know as Card Serial Number) of NFC card.

When any card is manufactured, it will be assigned a card serial number and it must be there if there is no any data.

When you try to fetch that UID using Android SDK NFC tag technology, it will return you UID in reverse order.

Generally when card ia manufactured, bytes are stored in LSB (Least Significant Byte) order while when Android read card serial number, it will read in MSB(Most Significant Byte) fashion.

For example. Any card has UID “12345678” then in MSB fashion, it will be like “78563412“.
So you need to convert this order from MSB to LSB.

Following short of code will help you to do this.

You may also like to read

Customizing TextInputLayout – Part 2 In previous article Customizing TextInputLayout - Part 1, we learnt how to customize TextInputLayout and how to apply hint color to it. Going t...
DevFestAhm – GDGAhmedabad 2015 – Aweso... Google Developer Group is Open for all including students, newbies, developers and anyone for all who are interested in Google technologies. It is Guj...
Auto Restart application after Crash/Force Close i... In an Android application, we usually got the "Force Closed" error if we didn't get the exceptions right. Everyone has question about "How can I resta...
Develop apps faster using Data Binding – Par... Google has been pushing updates to existing tools and making the life of android developers easier. They also have been releasing new libraries and AP...
Share on Facebook0Share on Google+0Tweet about this on TwitterShare on LinkedIn0Share on Reddit0Pin on Pinterest0Share on Tumblr0Email this to someone