Hide “NFC Tag type not supported” error on Samsung Galaxy devices

后端 未结 1 888
一向
一向 2021-01-18 14:47

I am working on an app that scans just the UID of MIFARE Classic cards to facilitate attendance registration. I have got it working. However, every time I scan a card on my

1条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-18 15:34

    Before Android 4.4

    What you are trying to do is simply not possible from an app (at least not on a non-rooted/non-modified device). The message "NFC tag type not supported" is displayed by the Android system (or more specifically the NFC system service) before and instead of dispatching the tag to your app. This means that the NFC system service filters MIFARE Classic tags and never notifies any app about them. Consequently, your app can't detect MIFARE Classic tags or circumvent that popup message.

    On a rooted device, you may be able to bypass the message using either

    1. Xposed to modify the behavior of the NFC service, or
    2. the CSC (Consumer Software Customization) feature configuration files on the system partition (see /system/csc/. The NFC system service disables the popup and dispatches MIFARE Classic tags to apps if the CSC feature is set to any value but "mifareclassic" or "all". For instance, you could use:

      NONE
      

      You could add this entry to, for instance, the file "/system/csc/others.xml" (within the section ... that already exists in that file).

    Since, you asked for the Galaxy S6 (the question that you linked) as well: I have tested this method on the S4 when it came out. I have not verified if this still works in the latest firmware or on other devices (e.g. the S6).

    Since Android 4.4

    This is pure guessing, but according to this (link no longer available), it seems that some apps (e.g. NXP TagInfo) are capable of detecting MIFARE Classic tags on affected Samsung devices since Android 4.4. This might mean that foreground apps are capable of bypassing that popup using the reader-mode API (see NfcAdapter.enableReaderMode) possibly in combination with NfcAdapter.FLAG_READER_SKIP_NDEF_CHECK.

    0 讨论(0)
提交回复
热议问题