Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-61793

NFC in Android is not working, was never working and/or examples are incomplete

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P2: Important
    • None
    • 5.9.1
    • Connectivity: NFC
    • None
    • Android

    Description

      Sorry for writing this, like this, but i have to.

       

      First thing, 3 years ago i implemented NFC using JNI, using the same phones i am using now, so it should be possible to make it work. Using Qt module for NFC i spent like more than 100h and i was unable to make it work. I have been programming in C++ for more than 10 years, and i passed the code to another friends to "find" the error, and they were unable to make it work.

      I try to write a NDEF message and read it in other android device.

      My manifest has

      <uses-permission android:name="android.permission.NFC"/>

      and

      <uses-feature android:name="android.hardware.nfc" android:required="false"/>

      This last thing seems necessary, but you can't find it in the only example using NFC on android.CorkBoard Example (Example to READ, no examples to write from android)

      I also have the

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

      that if i remember well, it allows the application to receive the filtered tags.

      My application creates a QNearFieldManager

      s_manager = new QNearFieldManager(this);
      
      qDebug() << "AVAILABLE "<<s_manager->isAvailable()<< s_manager->targetAccessModes();
      

       

      it returns

      AVAILABLE true QFlags<QNearFieldManager::TargetAccessMode>(NoTargetAccess)

      But i dont worry about as setTargetAccessModes just pass the argument to Q_UNUSED (you could document it, or people will lose hours calling setTargetAccessModes)

      i connect to signals of target detected, errors, etc... turn on NFC, put a device next to the other, and nothing, the NFC get activated, but Qt is not receiving any signal.

      I tried with QNearFieldShareManager and i got the same result.

       
      You can search in google for NFC and Qt, and you will only find people telling it is not working without an answer.

      My conclusion is that NFC is not working on android and/or the examples are incomplete. The API is not this big to miss something.

      If users (not just me) cant make it work, the thing is not working, even if it works (i really doubt it)

      i would love to try an example that actually works. Do you have one? (The existing examples cant be build for android without writing code)

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            ablasche Alex Blasche
            bnogal Benjamín Nogal
            Votes:
            2 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes