QT/QML Android: How to keep an app running when the last windows is closed?

1.9k Views Asked by At

I am developing a work order app for team works on the field. This app listens to server for work order.

I want this particular processing :

  • When I close the last window, my app must run in background.
  • Then, if my app catches a work order, it should give the user a notification.
  • Then the user touches the notification : the program must re-open.

How can I achieve that?

3

There are 3 best solutions below

0
On

For your first question change androidmanifiset.xml to

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

For second question I suggest to use QtAndroidTools (thank you Fabio Falsini)
https://github.com/FalsinSoft/QtAndroidTools

For your third question I suggest to look at this thread
QT/QML Android App, open app when click notification bar

4
On

Create a service which runs in background all the time and check for new work and display notification if work is available.

0
On

Simply put: It's not possible with Qt right now.

This applies for both, the background task and the notifications. If you want these features, you will have to implement them using Java.

The following link shows a good example on how to use the JNI to create a Qt-application that uses native android apis in java: https://www.qtdeveloperdays.com/sites/default/files/BogdanVatra_Extending_Qt_Android_Apps_with_JNI.pdf