aboutsummaryrefslogtreecommitdiffstats
path: root/examples/androidextras/notification/notificationclient.cpp
diff options
context:
space:
mode:
authorAssam Boudjelthia <assam.boudjelthia@qt.io>2020-03-04 14:42:13 +0200
committerAssam Boudjelthia <assam.boudjelthia@qt.io>2020-03-12 19:06:57 +0200
commita55cae70165206bd2a04306291fb3442968b69c3 (patch)
treef7b43a7d0eff5efc7c2ad5236770b7df2829a1c8 /examples/androidextras/notification/notificationclient.cpp
parentf4d122b2912e7bc13c9e076a32a6b5c080aa4825 (diff)
Fix notification example crashing
The notification example needed some fixing because it was crashing, now passing context from C++ side. There are some changes to the Android Notification API, so some changes has to be made to make sure the example works for different old and new Android API levels. + Updating the icons. Task-number: QTBUG-80717 Change-Id: I1560e31b73233895053b1a9a6a523a7b163c5d89 Reviewed-by: BogDan Vatra <bogdan@kdab.com>
Diffstat (limited to 'examples/androidextras/notification/notificationclient.cpp')
-rw-r--r--examples/androidextras/notification/notificationclient.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/examples/androidextras/notification/notificationclient.cpp b/examples/androidextras/notification/notificationclient.cpp
index 77b942c..871d889 100644
--- a/examples/androidextras/notification/notificationclient.cpp
+++ b/examples/androidextras/notification/notificationclient.cpp
@@ -50,7 +50,7 @@
#include "notificationclient.h"
-#include <QtAndroidExtras/QAndroidJniObject>
+#include <QtAndroid>
NotificationClient::NotificationClient(QObject *parent)
: QObject(parent)
@@ -75,8 +75,10 @@ QString NotificationClient::notification() const
void NotificationClient::updateAndroidNotification()
{
QAndroidJniObject javaNotification = QAndroidJniObject::fromString(m_notification);
- QAndroidJniObject::callStaticMethod<void>("org/qtproject/example/notification/NotificationClient",
- "notify",
- "(Ljava/lang/String;)V",
- javaNotification.object<jstring>());
+ QAndroidJniObject::callStaticMethod<void>(
+ "org/qtproject/example/notification/NotificationClient",
+ "notify",
+ "(Landroid/content/Context;Ljava/lang/String;)V",
+ QtAndroid::androidContext().object(),
+ javaNotification.object<jstring>());
}