[Interest] How to make the QML gui be never stopped on Android

Jérôme Godbout godboutj at amotus.ca
Thu Feb 15 16:43:27 CET 2018


You can update your model, but the GUI itself should never be able to render itself, else this might crash. The GUI will redraw only when bring back to front. You should only touch your model or create a queue of task to do when you go back up front. Running the main engine Qml, not sure this is possible, but I might be wrong on this, maybe Qt people can pitch in into this.


You should have a C++ model or DB that hold the data until the application is bring back to front to display those data.

________________________________
From: Denis Shienkov <denis.shienkov at gmail.com>
Sent: Thursday, February 15, 2018 10:00:54 AM
To: interest at qt-project.org
Cc: Jérôme Godbout
Subject: Re: [Interest] How to make the QML gui be never stopped on Android


Hi Jérôme,


> <meta-data android:name="android.app.background_running" android:value="true"/>


I already have this property in My manifect file.


> That service will need to communicate with your application through intent I think. The service could try to wake your application.


I need to continue render/update for some dynamic QML GUI even when an application goes to sleep.


I don't know how to use a service to render a some GUI stuff, e.g. in off-screen mode.


Maybe I need to use a QTimer which will call the QQuickWindow::update() method,

I don't know...


Denis.

15.02.2018 17:37, Jérôme Godbout пишет:

Hi,

I do the following for quick oauth2 background html handling:

<meta-data android:name="android.app.background_running" android:value="true"/>

inside the Qt activity tag of the AndroiManifest.xml


I wish it was easier to specify a single network activity that can continue into the background or at least a network intent that can wake the application up (could handle the message an/or bring application up front again).


I think you will need to create a service to have a full fledge UDP listener that continue even after the application screen goes off. That service will need to communicate with your application through intent I think. The service could try to wake your application. Not a specialist about this but this might help, good luck and let us known how you did solve it, I'm curious about all this, this still a pain to make those work properly.

________________________________
From: Interest <interest-bounces+godboutj=amotus.ca at qt-project.org><mailto:interest-bounces+godboutj=amotus.ca at qt-project.org> on behalf of Denis Shienkov <denis.shienkov at gmail.com><mailto:denis.shienkov at gmail.com>
Sent: Thursday, February 15, 2018 9:25:38 AM
To: interest at qt-project.org<mailto:interest at qt-project.org>
Subject: [Interest] How to make the QML gui be never stopped on Android


Hi all,

I use QML and Qt 5.9.3 on my Android application.

I achieved some tricks that my application continued to
work when the smartphone goes to sleep or when the user
presses the 'power' button, i.e. seems, that an
application running in background mode.

I do not use an Android service here (because I dont
know how to do it, also I'm not sure that this will help).

So, when the application goes to background mode,
I see that it continues to work, because I see that
my UDP "keep-alive" messages are sends and receives.

But, A MAIN problem is that a QML GUI is stopped then...
i.e. does not updates.

I need to do GUI grabbing in a real time and send it
to UDP in any case.

Is it possible to make a GUI work forewer?

BR,
Denis


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20180215/81f7240e/attachment.html>


More information about the Interest mailing list