Qt NFC on Android
Automatically Launching NDEF Message Handlers on Android
Android provides the possibility to automatically launch the application when touching the NDEF tag.
This can be achieved by providing an Android manifest file (AndroidManifest.xml) 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>
With this intent-filter enabled, the application will be automatically started once the NDEF NFC tag is touched.
Note: It's important to design your application in such a way that all the GUI is connected to the NFC classes before the target detection is actually started. Otherwise it will be impossible to show the information from the tag that caused application startup.
Note: It's important to touch the tag long enough for the application to start and read the information. If the tag is lost during application startup, no data will be available, and the tag needs to be touched again.
See Annotated URL application as an example.
Supported Tag Types
Supported tag types in Android are ACTION_NDEF_DISCOVERED, ACTION_TAG_DISCOVERED and ACTION_TECH_DISCOVERED with TagTechnology NdefFormatable or Ndef.
If the application registers other types in the Android manifest file, the application will be started, but the tag will never be processed.
© 2023 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.