From 5b1119b82570ce3dd1f7f45601ebffe8e9ac14c3 Mon Sep 17 00:00:00 2001 From: Lars Schmertmann Date: Tue, 17 Mar 2020 13:05:58 +0100 Subject: Fix the documentation for QtNFC in services on Android It is already possible to use QtNFC in Android services since Qt 5.9. Fixes: QTBUG-57646 Change-Id: Ib3d8a8101982cd9bf5e7c529d45491b49fede96d Reviewed-by: Alex Blasche --- src/nfc/doc/src/nfc-overview.qdoc | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/nfc/doc/src/nfc-overview.qdoc b/src/nfc/doc/src/nfc-overview.qdoc index 6ac5c1dc..cb10b400 100644 --- a/src/nfc/doc/src/nfc-overview.qdoc +++ b/src/nfc/doc/src/nfc-overview.qdoc @@ -45,8 +45,19 @@ With the Qt NFC API typical use cases are: The following sections describe how to use Qt NFC C++ classes and QML types for the above use cases. -\note On Android, Qt Nfc only works in foreground applications. Android services are not supported which is due to -API limitations on the Android side. +\note On Android, the detection of new NFC tags only works in foreground applications. Android +services do not support this because of API limitations on the Android side. The only way to use a +\l{https://developer.android.com/reference/android/nfc/Tag}{Tag} in a service is to provide an +\l{https://developer.android.com/guide/components/aidl}{AIDL} interface accepting the Tag and forward +it to Qt as shown in the following example. + +\code + public void setTag(Tag pTag) { + Intent newIntent = new Intent(); + newIntent.putExtra(NfcAdapter.EXTRA_TAG, pTag); + QtNative.onNewIntent(newIntent); + } +\ endcode \section1 C++ Overview -- cgit v1.2.3