NFC and Mifare UID Extension

I think I solved.
Attached my extension,
the source of the extension,
and an app inventor project for test.
At this moment the extension provide some information of a Mifare Classic Tag:

  • Uid
  • Type
  • Size
  • Number of Sectors
  • Number of Blocks

It should works also with Mifare Ultralight (but I don't have this kind of Tag to try)
To test the .aia you have to create and install the .apk
and the NFC in your smartphone must be enable

Who interested about this extension try it, and feel free to modify.
mifare.info.aix (12.7 KB)
MifareInfo.txt (9.7 KB)
MifareInfo.aia (14.6 KB)

Best Regards
Marco

4 Likes

Nice Extension @Marco_Perrone

I saw only two people who made an extension for NFC, so Congratulations @Marco_Perrone :star_struck: :kissing_heart:

And @Taifun please take a look at this. Thank you :pray: :grin:

Thank You very much Salman
:wave:t2:

1 Like

thank you for your contribution...
please edit your post and add a little bit of documentation...
which properties, methods and events are available? how to use it?
thank you
added in the extensions directory... https://puravidaapps.com/extensions.php

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by icon24 Taifun.

This is the new version of my MifareInfo extension.
In this version I have added some feautures:

  • Authentication with Key A
  • Read Block
  • Write Block
    The extension have some events and property and functions here a small explanation.
    The following events work when You approach a Mifare Tag to your smartphone with the app opened:
    image
    Provide the Mifare Tag Uid
    image
    Provide the Mifare Tag Type
    image
    Provide the Mifare Tag bytes size
    image
    Provide the Mifare Tag number of sectors
    image
    Provide the Mifare Tag number of blocks
    image

Provide all the info data of the last Mifare Tag approached
image

True to read a block, false to write a block
image

Provide the Key A necessary for the Mifare Classic Authentication after this it is possible Read or Write a block if the Key is correct and has the permission to do it.
The default Key A is FFFFFFFFFFFF
The Mifare Tag must be near the Android device
image

Read the Block specified (after the authentication) with a number between 0 and the number of blocks minus 1
The Mifare Tag must be near the Android device
The extension calculate the Sector to authenticate

image

Write the Block specified (after the authentication) with a number between 1 and the number of blocks minus 1.
The Mifare Tag must be near the Android device.
The extension calculate the Sector to authenticate
The data to be written must not be greater than 16 bytes, HEX format.
If You write less than 16 bytes the extension add 0 tho the remain bytes

N.B. Not all the blocks are equal in a Mifare Tag, every sector has blocks for user data and a block called sector trailer, here are stored the authentication key and the access bits. So You must pay attention to write data in the correct block or your Mifare Tag could become unavailable. Before to start write data is good to read this document to understand how Mifare Tag works https://www.nxp.com/docs/en/data-sheet/MF1S50YYX_V1.pdf

Here my latest files:
mifare.info.aix (15.9 KB) Extension
MifareInfo.txt (15.0 KB) Source file
MifareInfo.aia (27.7 KB) Project test

N.B. After You install the .apk the first time You approach a Mifare Tag to your device a pop-up wil ask You if You want to use the default NTAG Info app or our MifareInfo (or your project) , You must select MifareInfo (or your project) otherwise when You approach a Mifare Tag the intent will not go to our app

To avoid the problem that default NTAG Info app detect the tag instead our app I read that I should add:
android.nfc.action.NDEF_DISCOVERED,
android.nfc.action.TECH_DISCOVERED
in the intent filter
and add
name = "android.nfc.action.TECH_DISCOVERED", resource = "@xml/nfc_tech_list"
using @UsesActivityMetadata
and add the nfc_tech_list.xml file to the extension

and also add a PendingIntent and enableForegroundDispatch() in the right place.
help would be really appreciated by those with much more experience of me
@taifun @ewpatton or interested people could You take a look?
Thank You
Best Regards
Marco

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.