summaryrefslogtreecommitdiffstats
path: root/src/nfc/doc/src/nfc-android.qdoc
blob: d28f78eed9862ca6980050c92ad33abd191f5e19 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/****************************************************************************
**
** Copyright (C) 2015 BasysKom GmbH
** Contact: https://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:FDL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
\ingroup connectivity-nfc
\inmodule QtNfc
\since 5.6
\page nfc-android.html
\title Qt NFC on Android
\brief Notes on Nfc for Android.

\section1 Automatically launching NDEF message handlers on Android
Android, the registration of NDEF message handlers is done via the
\l{http://developer.android.com/guide/topics/manifest/manifest-intro.html}{Android manifest file}.
This means the application has to provide an AndroidManifest.xml file with proper
\l{http://developer.android.com/guide/topics/connectivity/nfc/nfc.html#manifest}{NFC intent-filter.}

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

When the application is started it has to register an message handler with
\l {QNearFieldManager::}{registerNdefMessageHandler()}
The first NDEF message arriving in the handler is the message that started the application.
See the \l {corkboard}{CorkBoard} application for an example.

\section2 Note:
Supported tag types in Android are
\l{http://developer.android.com/reference/android/nfc/NfcAdapter.html#ACTION_NDEF_DISCOVERED}{NDEF_DISCOVERED}
and
\l{http://developer.android.com/reference/android/nfc/NfcAdapter.html#ACTION_TECH_DISCOVERED}{ACTION_TAG_DISCOVERED}
with
\l{http://developer.android.com/reference/android/nfc/tech/TagTechnology.html}{TagTechnology}
NdefFormatable or Ndef.
If the application register other types in the
\l{http://developer.android.com/guide/topics/manifest/manifest-intro.html}{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.
*/