Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
androidjninfc.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 Centria research and development
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
5
6#include <QCoreApplication>
7#include <QtCore/qjnitypes.h>
8
10
11namespace QtNfc {
12
14{
15 return QtJniTypes::QtNfc::callStaticMethod<jboolean>("startDiscovery");
16}
17
19{
20 return QtJniTypes::QtNfc::callStaticMethod<jboolean>("isEnabled");
21}
22
24{
25 return QtJniTypes::QtNfc::callStaticMethod<jboolean>("isSupported");
26}
27
29{
30 return QtJniTypes::QtNfc::callStaticMethod<jboolean>("stopDiscovery");
31}
32
34{
35 return QtJniTypes::QtNfc::callStaticMethod<QtJniTypes::Intent>("getStartIntent");
36}
37
38QtJniTypes::Parcelable getTag(const QtJniTypes::Intent &intent)
39{
40 return QtJniTypes::QtNfc::callStaticMethod<QtJniTypes::Parcelable>("getTag", intent);
41}
42
43} // namespace QtNfc
44
45QT_END_NAMESPACE
46
47Q_DECL_EXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void * /*reserved*/)
48{
49 static bool initialized = false;
50 if (initialized)
51 return JNI_VERSION_1_6;
52 initialized = true;
53
54 JNIEnv* env;
55 if (vm->GetEnv(reinterpret_cast<void**>(&env), JNI_VERSION_1_6) != JNI_OK) {
56 return -1;
57 }
58
59 const auto context = QNativeInterface::QAndroidApplication::context();
60 QtJniTypes::QtNfc::callStaticMethod<void>("setContext", context);
61
62 return JNI_VERSION_1_6;
63}
bool stopDiscovery()
QtJniTypes::Intent getStartIntent()
bool startDiscovery()
bool isEnabled()
QtJniTypes::Parcelable getTag(const QtJniTypes::Intent &intent)
bool isSupported()