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 Android
QtWS25 Last Chance

NFC Android

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
4 Posts 2 Posters 1.5k Views
  • 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.
  • B Offline
    B Offline
    bnogal
    wrote on last edited by bnogal
    #1

    I have been for a week trying to use the NFC in android.

    3 years ago i implemented a tag transmitter for a mime tag using JNI, with the same mobiles i am using now.

    I dont wanna reuse that old code, as i modified the android.java, and i dont wanna reinvent the wheel for each platform Qt "gives" support for NFC

    Why there is a QNearFieldShareManager? Why not just QNearFieldManager
    When signal for a QNearFieldTarget detected is received, i run this:```

    
               qDebug() << "Target detected to read messages "<<target <<" "<<m_target->hasNdefMessage();
                connect(target,&QNearFieldTarget::ndefMessageRead,this,&NFCReader::readMessage, Qt::UniqueConnection);
                connect(target,&QNearFieldTarget::requestCompleted,this,&NFCHelper::processRequestCompleted, Qt::UniqueConnection);
                connect(target,&QNearFieldTarget::error,this,&NFCHelper::error, Qt::UniqueConnection);
                QNearFieldTarget::RequestId id = target->readNdefMessages();
                qDebug() << "VALID "<<id.isValid();```
    
    

    VALID returns true, but i get signal error, with error : QNearFieldTarget::Error(TargetOutOfRangeError)

    between "Target detected to read messages NearFieldTarget(0x5d35d620) true" and the VALID trace i get:

    W/System.err(27837): java.lang.NullPointerException
    W/System.err(27837): 	at android.nfc.tech.BasicTagTechnology.connect(BasicTagTechnology.java:73)
    W/System.err(27837): 	at android.nfc.tech.Ndef.connect(Ndef.java:76)
    W/System.err(27837): 	at dalvik.system.NativeStart.run(Native Method)
    
    

    The device sending the message, dont show any trace..? no QNearFieldTarget detected , so who is sending it, and what?
    If application is closed, when i receive the message it opens, as it is registered in the AndroidManifest

    I tryed using QNearFieldShareManager and QNearFieldManager directly

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

      After another 6 hours

      Now i get the events of target detected in the writter
      but still i get the same errors.

      But I give up. If someone ask me, i will say Qt dont support NFC in android, because this should be easy.

      jsulmJ 1 Reply Last reply
      0
      • B bnogal

        After another 6 hours

        Now i get the events of target detected in the writter
        but still i get the same errors.

        But I give up. If someone ask me, i will say Qt dont support NFC in android, because this should be easy.

        jsulmJ Offline
        jsulmJ Offline
        jsulm
        Lifetime Qt Champion
        wrote on last edited by
        #3

        @bnogal Did you check https://doc.qt.io/qt-5/nfc-android.html ?

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        B 1 Reply Last reply
        2
        • jsulmJ jsulm

          @bnogal Did you check https://doc.qt.io/qt-5/nfc-android.html ?

          B Offline
          B Offline
          bnogal
          wrote on last edited by bnogal
          #4

          @jsulm Thx for a reply in this desperating thing...
          I checked that page already (a bit hidden by the way). It is registered and the application get launched on tag detection, but i don't receive the data because the QNearFieldTarget::Error(TargetOutOfRangeError) probability related to the null pointer exception in java.

          i wonder if it could be related to https://bugreports.qt.io/browse/QTBUG-59343

          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