Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-61353

Android Service: "Self stopping" is buggy

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.9.0
    • QPA
    • None
    • * Arch Linux
       * Qt 5.9.0 armV7
       * Android SDK 26.0.2, build with android-25
       * Android NDK r15-1
    • Android

    Description

      When a android Qt service tries to stop itself, there are problems (that depend on the way it was stopped). Here are 4 Scenarios, to describe the problems:

      • Stopping the service from the outside (via context.stopService): Works as expected
      • Stopping the service by calling qApp->quit(); Does stop the Qt application, but not the service (i.e. The onDestroy will never be reached)
      • Stopping the service by calling Service.stopSelf(); (java method), It works only the first time the service is stopped. It it is started again, this method becomes useless
      • Combining qApp->quit(); and Service.stopSelf(); Again works the first time, but behaves just like qApp->quit(); for subsequent runs.

      I created a test project, See line 30 of main.cpp to switch between the different stop methods.

      The service shows an ongoing notification and a toast when started/created, and a normal notification when the Qt application dies, as well as a toast when the service is destoyed.

      Furthermore, it seems the ongoing notification is only shown the first time the service is started. I'm not shure if this could be related with the fact that stopSelf only works once, too.

      Is propably related with QTBUG-58471.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            taipan BogDan Vatra
            SkyCoder Felix Barz
            Votes:
            4 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes