Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
nfc-android.qdoc
Go to the documentation of this file.
1// Copyright (C) 2015 BasysKom GmbH
2// Copyright (C) 2021 The Qt Company Ltd.
3// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
4
5/*!
6\ingroup connectivity-nfc
7\inmodule QtNfc
8\since 5.6
9\page nfc-android.html
10\title Qt NFC on Android
11\brief Notes on Nfc for Android.
12
13\section1 Automatically Launching NDEF Message Handlers on Android
14
15Android provides the possibility to automatically launch the application when
16touching the NDEF tag.
17
18This can be achieved by providing an
19\l {https://developer.android.com/guide/topics/manifest/manifest-intro.html}
20{Android manifest file} (AndroidManifest.xml) with proper
21\l{https://developer.android.com/guide/topics/connectivity/nfc/nfc.html#manifest}
22{NFC intent-filter}.
23
24\badcode
25<intent-filter>
26 <action android:name="android.nfc.action.NDEF_DISCOVERED"/>
27 <category android:name="android.intent.category.DEFAULT"/>
28 <data android:mimeType="text/plain"/>
29</intent-filter>
30\endcode
31
32With this intent-filter enabled, the application will be automatically started
33once the NDEF NFC tag is touched.
34
35\note It's important to design your application in such a way that all the GUI
36is connected to the NFC classes before the target detection is actually started.
37Otherwise it will be impossible to show the information from the tag that caused
38application startup.
39
40\note It's important to touch the tag long enough for the application to start
41and read the information. If the tag is lost during application startup, no data
42will be available, and the tag needs to be touched again.
43
44See \l {annotatedurl}{Annotated URL} application as an example.
45
46\section2 Supported Tag Types
47
48Supported tag types in Android are
49\l {https://developer.android.com/reference/android/nfc/NfcAdapter.html#ACTION_NDEF_DISCOVERED}
50{ACTION_NDEF_DISCOVERED},
51\l {https://developer.android.com/reference/android/nfc/NfcAdapter.html#ACTION_TAG_DISCOVERED}
52{ACTION_TAG_DISCOVERED} and
53\l {https://developer.android.com/reference/android/nfc/NfcAdapter.html#ACTION_TECH_DISCOVERED}
54{ACTION_TECH_DISCOVERED} with
55\l {https://developer.android.com/reference/android/nfc/tech/TagTechnology.html}
56{TagTechnology} \e NdefFormatable or \e Ndef.
57
58If the application registers other types in the
59\l {https://developer.android.com/guide/topics/manifest/manifest-intro.html}
60{Android manifest file}, the application will be started, but the tag will never
61be processed.
62
63*/
64