2

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?

Anthony Geoghegan
  • 11,533
  • 5
  • 49
  • 56
DJ.Yosemite
  • 285
  • 4
  • 13

3 Answers3

2

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

Felix
  • 6,885
  • 1
  • 29
  • 54
2

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

pogojotz
  • 452
  • 5
  • 11
milad
  • 84
  • 5
1

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

Ameer Faisal
  • 355
  • 1
  • 9
  • Amerr Faisal.Can you give me some exapmle.Which way , or metods ? – DJ.Yosemite Apr 11 '16 at 12:49
  • 2
    Currently Qt can't create android services, this feature is planned for Qt 5.7. – dtech Apr 11 '16 at 12:50
  • ddriver , It is not important to use service in background.Is there an alternative way to listen server(QThread etc..) when close last windows – DJ.Yosemite Apr 11 '16 at 13:09
  • An [interesting comment](https://bugreports.qt.io/browse/QTBUG-37221?focusedCommentId=279778&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-279778) about the Qt 5.7 services. IMO, the best option at the moment is to create the service in Java and interact with it via a custom main activity. – BaCaRoZzo Apr 11 '16 at 20:21