2 Replies Latest reply on Oct 6, 2016 3:31 AM by leol91829087

    The background task is not activated correctly on Android

    leol91829087

      Hi,

       

      after an interruption of my app with the home button, I can observe three scenarios after restart:

       

      Scenario 1 (with cli-6.3.0):

      The existing task has been activated.

      The app starts on the page that was previously interrupted.

      The history of the previous session is correct.

       

      Scenario 2 (with cli-6.3.0):

      A new task has been created.

      The app starts with the initialization page.

      The history of the previous session has not been deleted correctly.

      If I press Back, the pages from the previous session are displayed.

       

      Scenario 3 (with older versions, not more)

      The app starts with the initialization page.

      The history of the previous session was deleted correctly.

       

      After installing the app, Scenarios 1 and 2 occur approximately the same number of times.

      After intensive use only scenario 2 occurs.

       

      How can I prevent scenario 2.

       

      I have already experimented with all combinations of Preference KeepRunning true / false and AndroidLaunchMode standard / singleTop / singleTask / singleInstance.

      The result was always the same.

       

      Thanks!

        • 1. Re: The background task is not activated correctly on Android
          kerrishotts Adobe Community Professional

          You might want to use your own backbutton handler instead? Without seeing any code & config.xml settings, it's going to be difficult to troubleshoot.

          • 2. Re: The background task is not activated correctly on Android
            leol91829087 Level 1

            I've reduced the app to 2 files.

            Config.xml and index.html.

            And the error still exists.

             

            If I open the app in the course of the installation and then finish it with Back, then inactive task will not be correctly reused.

             

            Each time the app is started, a new task is created.

            The inactive tasks remain unaffected.

             

            When I press Back, the pages of the previously inactive tasks are shown.

             

            index.html:

            <!DOCTYPE html>

            <html lang=de>

              <head>  

                <meta charset='ISO-8859-1'/> 

                <meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no' />

              </head> 

              <body>   

             

                  <h1>

                  

                      <div id="Page1" style="height: 2000px">

                          This is page 1.

                          <br><br>

                          <a href="#Page2">Show page 2.</a>

                      </div>

                     

                      <div id="Page2" style="height: 2000px; color:red">

                          This is page number 2.

                      </div>

                       

                  </h1>

               

              </body>

            </html>

             

            config.xml:

            <?xml version="1.0" encoding="UTF-8" ?>

            <widget xmlns   = "http://www.w3.org/ns/widgets"

                xmlns:gap   = "http://phonegap.com/ns/1.0"

                id          = "com.phonegap.example"

                versionCode = "10"

                version     = "1.0.0" >

             

                <name>ABAKUS</name>

             

                <description>

                    ABAKUS die koenigliche Tarock-App.

                </description>

             

                <author href="http://ABAKUS.parseapp.com/" email="Luger.Leo@gmail.com">

                    Leopold Luger

                </author>

               

                <gap:platform name="android" />  

             

            </widget>