• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login
UBports Robot Logo UBports Forum
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login

App daemon - how to?

Scheduled Pinned Locked Moved App Development
8 Posts 5 Posters 759 Views 2 Watching
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H Offline
      Homer
      last edited by 17 Nov 2021, 22:44

      Hi everyone,
      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....

      D M 2 Replies Last reply 18 Nov 2021, 21:29 Reply Quote 0
      • D Offline
        dobey @Homer
        last edited by 18 Nov 2021, 21:29

        @homer said in App daemon - how to?:

        Can anyone tell me how this can be done? I cannot find any documentation for that....

        There is no support for background processing as of yet.

        1 Reply Last reply Reply Quote 0
        • M Offline
          matteo @Homer
          last edited by 19 Nov 2021, 06:23

          @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

          1 Reply Last reply Reply Quote 0
          • F Offline
            flohack
            last edited by 19 Nov 2021, 15:43

            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.

            My languages: πŸ‡¦πŸ‡Ή πŸ‡©πŸ‡ͺ πŸ‡¬πŸ‡§ πŸ‡ΊπŸ‡Έ

            H 1 Reply Last reply 20 Nov 2021, 09:59 Reply Quote 0
            • H Offline
              Homer @flohack
              last edited by 20 Nov 2021, 09:59

              @flohack thank you and others for answering, I almost expected this

              F 1 Reply Last reply 21 Nov 2021, 11:32 Reply Quote 0
              • F Offline
                flohack @Homer
                last edited by 21 Nov 2021, 11:32

                @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.

                My languages: πŸ‡¦πŸ‡Ή πŸ‡©πŸ‡ͺ πŸ‡¬πŸ‡§ πŸ‡ΊπŸ‡Έ

                H 1 Reply Last reply 22 Nov 2021, 20:13 Reply Quote 0
                • H Offline
                  Homer @flohack
                  last edited by Homer 22 Nov 2021, 20:13

                  @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.)

                  A 1 Reply Last reply 23 Nov 2021, 11:51 Reply Quote 0
                  • A Online
                    arubislander @Homer
                    last edited by 23 Nov 2021, 11:51

                    @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

                    πŸ‡¦πŸ‡Ό πŸ‡³πŸ‡± πŸ‡ΊπŸ‡Έ πŸ‡ͺπŸ‡Έ
                    Happily running Ubuntu Touch
                    Google Pixel 3a (20.04 DEV)
                    JingPad (24.04 preview)
                    Meizu Pro 5 (16.04 DEV)

                    1 Reply Last reply Reply Quote 0
                    7 out of 8
                    • First post
                      7/8
                      Last post