Hide "NFC Tag type not supported" error on Samsung Galaxy devices

I am working on an application that scans only the MIDARE Classic UID cards in order to simplify attendance registration. It works for me. However, every time I scan a card on my Galaxy S4, I get a toast that says "NFC tag type is not supported."

I want to block or hide this message while the application is open.

I noticed that on the Galaxy S6 there was another question requiring the same, but once voted for it, and then ignored.

I found this conversation on the Samsung developers forum, but I could not extract the answer from what was written there:

if (NfcAdapter.ACTION_TECH_DISCOVERED.equals(intent.getAction())) { myTag = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG); tagID = intent.getByteArrayExtra(NfcAdapter.EXTRA_ID); alertDialog.dismiss(); 

It looks like I need the alertDialog.dismiss() section but there is no explanation where they alertDialog from the alertDialog object.

+5
source share
1 answer

Before Android 4.4

What you are trying to do is simply not possible from the application (at least on an unrouted / unmodified device). The message "NFC tag type is not supported" is displayed by the Android system (or rather, the NFC system service) before and instead of sending the tag to your application. This means that the NFC system service filters the MIFARE Classic tags and never notifies any application about them. Therefore, your application cannot detect MIFARE Classic tags or bypass this pop-up message.

On a rooted device, you can bypass the message using

  1. Xposed to change the behavior of the NFC service, or
  2. CSC function configuration files (consumer software settings) in the system partition (see / system / csc /. The NFC system service disables the pop-up window and sends MIFARE Classic tags to applications if the CSC function <CscFeature_NFC_EnableSecurityPromptPopup> is set to any value but "mifareclassic "or" all ". For example, you can use:

     <CscFeature_NFC_EnableSecurityPromptPopup>NONE</CscFeature_NFC_EnableSecurityPromptPopup> 

    You can add this entry, for example, to the file "/system/csc/others.xml" (in the <FeatureSet>... </FeatureSet> that already exists in this file).

Since then, you asked about the Galaxy S6 (the question you related ): I tested this method on S4 when it came out. I did not check if this works in the latest firmware version or on other devices (for example, S6).

Starting with Android 4.4

This is pure speculation, but according to this (the link is no longer available), it seems that some applications (for example, NXP TagInfo) are able to detect MIFARE Classic tags on vulnerable Samsung devices starting with Android 4.4. This may mean that foreground applications are able to bypass this popup using the read-mode API ( see NfcAdapter.enableReaderMode ), possibly in combination with NfcAdapter.FLAG_READER_SKIP_NDEF_CHECK .

+4
source

Source: https://habr.com/ru/post/1244778/


All Articles