diff options
author | Assam Boudjelthia <[email protected]> | 2021-05-11 12:49:40 +0300 |
---|---|---|
committer | Assam Boudjelthia <[email protected]> | 2021-06-29 14:08:24 +0300 |
commit | ae24e41ad4da78b029fd42ea317e4d2be73b015e (patch) | |
tree | 3f2d8c44dbf5a3eb666a7782bb5c1dfd62481c8e /examples/androidextras/notification/doc | |
parent | ede82024b08842e9599b9bdbd00b7498601a921f (diff) |
The JNI utilities (i.e. QJniObject, QJniEnvironment) are already under
qtbase as public APIs.
Permission handling is now under QCoreApplication::{check,request}Permission
and QPermission namespace.
Some of the QtAndroid namespace functions are now under QNativeInterface's
QAndroidApplication, this includes:
* sdkVersion()
* hideSplashScreen()
* context() and isActivityContext()
* runOnAndroidMainThread()
The remaining APIs are now moved as private APIs under qtbase
ee05af296f65e240f64db6470cdddafbddbf2fa3. That is until we add
new cross-platform APIs to replace their functionalities like
Intents handling, starting activites and working with Services.
Task-number: QTBUG-83251
Task-number: QTBUG-84382
Pick-to: 6.2
Change-Id: Id077f8cbbe223a987916f737fad6088fb58e470d
Reviewed-by: Ville Voutilainen <[email protected]>
Diffstat (limited to 'examples/androidextras/notification/doc')
-rw-r--r-- | examples/androidextras/notification/doc/src/qtandroidextras-example-notification.qdoc | 106 |
1 files changed, 0 insertions, 106 deletions
diff --git a/examples/androidextras/notification/doc/src/qtandroidextras-example-notification.qdoc b/examples/androidextras/notification/doc/src/qtandroidextras-example-notification.qdoc deleted file mode 100644 index a042af5..0000000 --- a/examples/androidextras/notification/doc/src/qtandroidextras-example-notification.qdoc +++ /dev/null @@ -1,106 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://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$ -** -****************************************************************************/ - -/*! - \title Qt Notifier - \ingroup examples-qtandroidextras - \example notification - \brief Demonstrates calling Java code from an Android application. - - \image notification.png - - This example demonstrates how to add a custom Java class to an Android application, and - how to call into this using the JNI convenience APIs in the Qt Android Extras module. - The application UI is created by using Qt Quick. - - Click on either of the smiley faces to put a notification in the status area of the Android - device. - - \include examples-run.qdocinc - - \section1 Calling Java Methods from C++ Code - - We define a custom Java class called \c NotificationClient in the - NotificationClient.java file: - - \quotefromfile notification/android/src/org/qtproject/example/notification/NotificationClient.java - \skipto org.qtproject.example.notification - \printuntil /^\}/ - - In the NotificationClient C++ class header file, notificationclient.h, we - declare a simple C++ API to display notifications on an Android device. It - consists of a single string property, \c notification, and a slot, - \c updateAndroidNotification(), that calls the Java code: - - \quotefromfile notification/notificationclient.h - \skipto Q_PROPERTY - \printuntil ) - \dots - \skipto private slots - \printuntil updateAndroidNotification() - - A NotificationClient object is exposed to the QML in the main source file, - main.cpp: - - \quotefromfile notification/main.cpp - \skipto QQuickView view; - \printuntil notificationClient); - - In the NotificationClient C++ class source file, notificationclient.cpp, we - import the QtAndroid class: - - \quotefromfile notification/notificationclient.cpp - \skipto <QtAndroid - \printuntil > - - This will allow us to use \c QAndroidJniObject for JNI calls, and also allow - us to pass our application's context to the Java methods as in: - - \code - QtAndroid::androidContext().object() - \endcode - - We connect the \c notificationChanged() signal to the - \c updateAndroidNotification() slot to update the notification text when the - \c notification property changes: - - \printuntil } - - The \c NotificationClient::updateAndroidNotification() function calls the - Java method. We construct a Java string from the \c notification string - property: - - \skipto updateAndroidNotification() - \printuntil fromString - - And pass the string object as a parameter to the Java \c notify() method. - Note that we must supply the signature ourselves: - - \printuntil } - - \sa {Qt for Android}, {Qt Android Extras} -*/ |