Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. NFC on Android
Qt 6.11 is out! See what's new in the release blog

NFC on Android

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
8 Posts 3 Posters 3.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • NickVN Offline
    NickVN Offline
    NickV
    wrote on last edited by
    #1

    Does the nfc plugin for android works?
    I've tried by using the c++ and the qml but nothing worked.

    1 Reply Last reply
    0
    • NickVN Offline
      NickVN Offline
      NickV
      wrote on last edited by
      #2

      I found this:

      Note: On Android, Qt Nfc only works in foreground applications. Android services are not supported which is due to API limitations on the Android side.

      Does this mean that i can not write a program in qt to read nfc tags from android?

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi,

        No, it means that your application must be the current active one in order to get something from the NFC reader.

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0
        • NickVN Offline
          NickVN Offline
          NickV
          wrote on last edited by
          #4

          I run the examples into my android device (samsung galaxy s2 plus) but it returns that "NFC not available". Why is that?

          1 Reply Last reply
          0
          • NickVN Offline
            NickVN Offline
            NickV
            wrote on last edited by NickV
            #5

            An example of my code is:

            m_manager = new QNearFieldManager(this);
            if (!m_manager->isAvailable()) {
            qWarning() << "NFC not available";
            return;
            }

            QNdefFilter filter;
            filter.setOrderMatch(false);
            connect(m_manager, SIGNAL(targetDetected(QNearFieldTarget*)),
                    this, SLOT(targetDetected(QNearFieldTarget*)));
            connect(m_manager, SIGNAL(targetLost(QNearFieldTarget*)),
                    this, SLOT(targetLost(QNearFieldTarget*)));
            

            I also write this into manifest in order to be the current one:

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

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Did you try to run one of Qt's NFC examples ?

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • B Offline
                B Offline
                bnogal
                wrote on last edited by
                #7

                What example i can use to run it in Android?
                The only one is to read, that is QML CorkBoard example, and it can only read android:mimeType="text/plain"

                And i think the example to write records, NFCeditor, can only generate text records not encoded as mime.

                So if i modify that examples to make them "run", i will end up having the same as in my application that is not working.

                In the other hand, i found out a problem in my code, mime must be lowercase. If this can help somebody

                1 Reply Last reply
                0
                • B Offline
                  B Offline
                  bnogal
                  wrote on last edited by
                  #8

                  I write because my thread with same topic...
                  https://forum.qt.io/topic/80451/nfc-android

                  1 Reply Last reply
                  0

                  • Login

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • Users
                  • Groups
                  • Search
                  • Get Qt Extensions
                  • Unsolved