-
Bug
-
Resolution: Done
-
P2: Important
-
5.9.2, 5.10.1, 5.11.0 Beta 2
-
None
-
Cross-compile Win10/Android
Tested on Android NDKr10e, NDKr11c, NDKr15c
Android SDK: 24.2.5
Qt : 5.9.2
JDK 1.8.0_20
Ant 1.9.7
Tested on Android 5.1.1, 6 & 7
If the QNearFieldManager is created too early (during the app startup & before the app.exec()), a NFC card Id is not read.
To solve that problem, add a delay which gives a chance to the QMainLoop to start & then create the QNearFieldManager. There is no need to add a delay between the QNearFieldManager creation & the startTargetDetection call.
NfcClient::NfcClient(QObject *parent): QObject(parent)
{
// Does not work
// manager = new QNearFieldManager(this);
// Works
QTimer::singleShot(100, this, SLOT(onInitNfc()));
}
void NfcClient::onInitNfc(void)
{
manager = new QNearFieldManager(this);
manager->startTargetDetection();
...
}
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
NfcClient nfcclient;
return a.exec();
}
Manifest file :
<activity ... <intent-filter> <action android:name="android.nfc.action.NDEF_DISCOVERED"/> <category android:name="android.intent.category.DEFAULT"/> <data android:mimeType="text/plain"/> </intent-filter> <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> ...
- is duplicated by
-
QTBUG-65118 NFC detection is not properly started
-
- Closed
-