Qt NFC on Android

Automatically launching NDEF message handlers on Android

Android, the registration of NDEF message handlers is done via the Android manifest file. This means the application has to provide an AndroidManifest.xml file with proper NFC intent-filter.

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

When the application is started it has to register an message handler with registerNdefMessageHandler() The first NDEF message arriving in the handler is the message that started the application. See the CorkBoard application for an example.

Note:

Supported tag types in Android are NDEF_DISCOVERED and ACTION_TAG_DISCOVERED with TagTechnology NdefFormatable or Ndef. If the application register other types in the Android manifest file the application will be started, but the tag will never get delivered to the handler. The handler should be registered as early as possible. If the application has not registered a handler, the application will be started every time a new tag is in range and the Android device end up running multiple instances of the application.

© 2020 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.