Application In the background stop
-
@NickV said in Application In the background stop:
Also any suggestions about how i can stop this annoying behaviour?
If you talk about Android there is no way, since this is intended to behavior. The Android system manages the lifecycle of the app.
If you depend on background functionality you should take a look at Android services. -
@NickV
as i said. If you have this requirement you need to use Android services (rather than App). The App then communicates with the Android Service.If you are working on Android afterall, since you didn't answer that question yet.
But anyway, if it is all about a DB connection. Why do you need to be connected even if your app is in the background? Why don't you simple resetup the connection everytime the app comes back to the foreground, than drowning the device's battery with functionality which isn't necessary while the app is in the background?!
-
Yes i work with Android.
I need to be all the time connected because i use notification manager in order to notify the user about incoming data. The problem is that if i use services i need to make the service reconnect to the database if i loose internet connection and subscribe again to the notifications. I don't even know if this is possible with the postgres driver because i've tested postegres to be opened in another thread for example and triggers not work. So i don't know if postgres works with services. -
@NickV said in Application In the background stop:
So i don't know if postgres works with services.
There is not much difference between an App and a Service. A service runs permanently in the background and has no UI.
From Qt point of view the difference is even less. So i don't see why it shouldn't work.- create a Android service
- in the service setup your DB connection
- create an Android app
- use IPC to communicate with the service (e.g. you can use QtRemoteObjects for that)
- when the service triggers a notification message let the app display it