App daemon - how to?
I'm developing an app where the user should get a notification when the last sqlite entry was made more then x hours ago.
So i would like to implement some daemon which is called by UT in specific intervals. That daemon should run a function in my Database.js (Database logic) and based on the result show a notification.
Can anyone tell me how this can be done? I cannot find any documentation for that....
dobey last edited by
@homer hi, as Rodney said, daemon running in the background isn't yet supported in Ubuntu Touch. Nonetheless, there is a way to set a daemon triggering an action at constant time step for instance, there is a bunch of unconfined apps doing that, which are published in the OpenStore. If you want to replicate what I made for my app in this regard, have a look at repository of my app: dataMonitor
Flohack last edited by
With making an unconfined app it would be possible to set this up, you can see that Dekko 2 installs a background daemon and a frontend App.
But its then off all protections and such Apps should not be the norm.
@flohack thank you and others for answering, I almost expected this
Flohack last edited by
@homer We have an unresolved discussion from time to time about this for 5 or 6 years now The basic question is, if we allow background daemons, how to prevent them of being adversaries and eat too much battery and bandwidth? Like you can see with dekko, for example, there is a bug inside that sets the daemon to 100% CPU busy-waiting if you are in a WiFi without internet access: It detects there is a network, but then fails to reach your mail server. and retries immediately.
Its so hard to satisfy all stakeholders when it comes to background activity for apps. And so far nobody has presented a sound concept.
@flohack I don't feel I'm in the position to make proposals as a UT beginner. I thought you could use something like crontab that calls your app and the app runs 'invisible' in the background and performs some predefined task ( Fetch mail, bank statements, messenger messages ,etc.)
arubislander last edited by
@homer: Cron was written with an always-on server or a mostly-on desktop / laptop in mind.
A mobile device needs to actually be mostly-off to get the longest possible battery life, while appearing to the user to be on-demand-on.
The traditional tools for Linux simply we're not written with this use case in mind. So using them as is would degrade the use experience in an unacceptable way for most, if not all users.
That having been said, for as long as UT is still based on 16.04, you could use Upstart Session Jobs