summarylogtreecommitdiffstats
path: root/0015-Allow-keeping-Android-app-in-background-with-QtQuick.patch
blob: 59c128efcff305671193414528dd73df594e0c28 (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
From 4a22a4921dcc8d8bf3b7c3585dbf9b6e21ab420f Mon Sep 17 00:00:00 2001
From: Martchus <martchus@gmx.net>
Date: Sun, 4 May 2025 00:51:18 +0200
Subject: [PATCH 15/24] Allow keeping Android app in background with
 QtQuickView

Do not terminate Qt as this would stop the main Qt thread which is not
desirable when the app is supposed to keep running in the background (and
still supposed to process events via the Qt event loop, e.g. to process
network traffic and update a notification accordingly). This change also
makes sure that the absence of an activity or service is treated as if the
app is not a "full" Qt application as we're still just using QtQuickView
here.

Change-Id: I18e2c2a054b19bdbdbe03d189f9a36dcdbe1e204
---
 .../jar/src/org/qtproject/qt/android/QtEmbeddedDelegate.java    | 1 -
 src/plugins/platforms/android/androidjnimain.cpp                | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/android/jar/src/org/qtproject/qt/android/QtEmbeddedDelegate.java b/src/android/jar/src/org/qtproject/qt/android/QtEmbeddedDelegate.java
index b55aa957506..2ecc0f17ec5 100644
--- a/src/android/jar/src/org/qtproject/qt/android/QtEmbeddedDelegate.java
+++ b/src/android/jar/src/org/qtproject/qt/android/QtEmbeddedDelegate.java
@@ -75,7 +75,6 @@ class QtEmbeddedDelegate extends QtActivityDelegateBase
                     m_activity.getApplication().unregisterActivityLifecycleCallbacks(this);
                     QtNative.unregisterAppStateListener(QtEmbeddedDelegate.this);
                     QtEmbeddedViewInterfaceFactory.remove(m_activity);
-                    QtNative.terminateQtNativeApplication();
                     QtNative.setActivity(null);
                 }
             }
diff --git a/src/plugins/platforms/android/androidjnimain.cpp b/src/plugins/platforms/android/androidjnimain.cpp
index 46494d76007..04c303610c1 100644
--- a/src/plugins/platforms/android/androidjnimain.cpp
+++ b/src/plugins/platforms/android/androidjnimain.cpp
@@ -181,7 +181,7 @@ namespace QtAndroid
             return env->IsInstanceOf(QtAndroidPrivate::service().object(), m_qtServiceClass);
         // return true as default as Qt application is our default use case.
         // famous last words: we should not end up here
-        return true;
+        return false;
     }
 
 #if QT_CONFIG(accessibility)
-- 
2.56.0