NFC Android

  • 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, 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
    W/System.err(27837): 	at
    W/System.err(27837): 	at 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

  • 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.

  • Moderators

  • @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

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.