Android won't quit

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Android won't quit

dunbarxx via use-livecode
Does anyone have a workaround to completely quit an Android app? I just
re-opened this bug report that claimed to have fixed the problem but it
didn't really: https://quality.livecode.com/show_bug.cgi?id=19420

I can block the backKey message and do nothing, but then the user can't
use the backKey to quit the app. They can use the Home or Switcher
buttons but the app is still in its old state when it is restarted. If I
pass backKey, the app crashes on relaunch if it is still in RAM.

I want to wipe the app completely so that on next launch I can
reinitialize everything.

--
Jacqueline Landman Gay         |     [hidden email]
HyperActive Software           |     http://www.hyperactivesw.com

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Android won't quit

dunbarxx via use-livecode
Argh.  I thought I solved in this in my app. But LO... it appears to quit... but is actually not quitting... it leaves  a "corrupt" stack on the phone (android) and when you try to restart it, it opens to splash screen stack, but no messages are firing.  It is "stuck" ; does not appear to user as "crashed" ; but on is dead-on-arrival - just the card 1 of the launcher stack app, with logo.

Good think you caught this. I will have to let users on android force stop, as the only choice.

BR

J. Landman Gay

    I want to wipe the app completely so that on next launch I can
    reinitialize everything.
   
   

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

RE: Android won't quit

dunbarxx via use-livecode
This is not an easy thing to fix and can be broken easily. The app in memory is not corrupt but the restart of the app is probably exposing an LC engine bug.

Details for geeks...

To handle the Android unique app restart protocol: After you "Quit" or the app gets hibernated so to speak by the OS, the state of Activities, Fragments and Views will be saved. When returning back to the application , the system will start the process again, recreate the top activity. and you will get a Bundle with the stored state. This is where thing can go sideways,  the whole process was killed. So any Singletons (or any “application scope” objects), any temporary data, any data stored in “retained Fragments” ... Everything will be in a state as if the app was just launched , with one big difference , the state is restored and the app is at the point where you left the app. If the Activity you are depending on has some shared Object, or some injected dependency where you keep recent data then most likely the application will just crash on a NullPointerException because it didn’t expect the data to be null.

The Android OS is designed not to allow apps to be "stopped/killed" like desktop apps. That is why in the Application Manager it's call "Force stop". To work around the OS design (limitation?) LC could initiate the various activities with startActivityForResult(), and have the LC "quit" send back a result which tells the parent activity to finish(). That activity could then send the same result as part of its onDestroy(), which would cascade back to the main activity and result in no running activities, which should cause the app to close. But this is fighting the basic design of the Android OS and might break with a future OS upgrade.


Ralph DiMola
IT Director
Evergreen Information Services
[hidden email]

-----Original Message-----
From: use-livecode [mailto:[hidden email]] On Behalf Of Sannyasin Brahmanathaswami via use-livecode
Sent: Thursday, June 07, 2018 12:26 PM
To: How to use LiveCode
Cc: Sannyasin Brahmanathaswami
Subject: Re: Android won't quit

Argh.  I thought I solved in this in my app. But LO... it appears to quit... but is actually not quitting... it leaves  a "corrupt" stack on the phone (android) and when you try to restart it, it opens to splash screen stack, but no messages are firing.  It is "stuck" ; does not appear to user as "crashed" ; but on is dead-on-arrival - just the card 1 of the launcher stack app, with logo.

Good think you caught this. I will have to let users on android force stop, as the only choice.

BR

J. Landman Gay

    I want to wipe the app completely so that on next launch I can
    reinitialize everything.
   
   

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Android won't quit

dunbarxx via use-livecode
In reply to this post by dunbarxx via use-livecode
When I first reported it, the problem was that the quit command unloaded
all the libraries but left the app in memory. Sounds like what you see now.
In my app it just crashes, but probably for the same reason.

--
Jacqueline Landman Gay | [hidden email]
HyperActive Software | http://www.hyperactivesw.com
On June 7, 2018 11:28:18 AM Sannyasin Brahmanathaswami via use-livecode
<[hidden email]> wrote:

> Argh.  I thought I solved in this in my app. But LO... it appears to
> quit... but is actually not quitting... it leaves  a "corrupt" stack on the
> phone (android) and when you try to restart it, it opens to splash screen
> stack, but no messages are firing.  It is "stuck" ; does not appear to user
> as "crashed" ; but on is dead-on-arrival - just the card 1 of the launcher
> stack app, with logo.
>
> Good think you caught this. I will have to let users on android force stop,
> as the only choice.
>
> BR
>
> J. Landman Gay
>
>    I want to wipe the app completely so that on next launch I can
>    reinitialize everything.
>
>
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode




_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

RE: Android won't quit

dunbarxx via use-livecode
In reply to this post by dunbarxx via use-livecode
It could be solved if we had suspend and resume messages but I heard this
is difficult to implement on Android.
--
Jacqueline Landman Gay | [hidden email]
HyperActive Software | http://www.hyperactivesw.com
On June 7, 2018 12:49:10 PM Ralph DiMola via use-livecode
<[hidden email]> wrote:

> This is not an easy thing to fix and can be broken easily. The app in
> memory is not corrupt but the restart of the app is probably exposing an LC
> engine bug.
>
> Details for geeks...
>
> To handle the Android unique app restart protocol: After you "Quit" or the
> app gets hibernated so to speak by the OS, the state of Activities,
> Fragments and Views will be saved. When returning back to the application ,
> the system will start the process again, recreate the top activity. and you
> will get a Bundle with the stored state. This is where thing can go
> sideways,  the whole process was killed. So any Singletons (or any
> “application scope” objects), any temporary data, any data stored in
> “retained Fragments” ... Everything will be in a state as if the app was
> just launched , with one big difference , the state is restored and the app
> is at the point where you left the app. If the Activity you are depending
> on has some shared Object, or some injected dependency where you keep
> recent data then most likely the application will just crash on a
> NullPointerException because it didn’t expect the data to be null.
>
> The Android OS is designed not to allow apps to be "stopped/killed" like
> desktop apps. That is why in the Application Manager it's call "Force
> stop". To work around the OS design (limitation?) LC could initiate the
> various activities with startActivityForResult(), and have the LC "quit"
> send back a result which tells the parent activity to finish(). That
> activity could then send the same result as part of its onDestroy(), which
> would cascade back to the main activity and result in no running
> activities, which should cause the app to close. But this is fighting the
> basic design of the Android OS and might break with a future OS upgrade.
>
>
> Ralph DiMola
> IT Director
> Evergreen Information Services
> [hidden email]
>
> -----Original Message-----
> From: use-livecode [mailto:[hidden email]] On Behalf
> Of Sannyasin Brahmanathaswami via use-livecode
> Sent: Thursday, June 07, 2018 12:26 PM
> To: How to use LiveCode
> Cc: Sannyasin Brahmanathaswami
> Subject: Re: Android won't quit
>
> Argh.  I thought I solved in this in my app. But LO... it appears to
> quit... but is actually not quitting... it leaves  a "corrupt" stack on the
> phone (android) and when you try to restart it, it opens to splash screen
> stack, but no messages are firing.  It is "stuck" ; does not appear to user
> as "crashed" ; but on is dead-on-arrival - just the card 1 of the launcher
> stack app, with logo.
>
> Good think you caught this. I will have to let users on android force stop,
> as the only choice.
>
> BR
>
> J. Landman Gay
>
>    I want to wipe the app completely so that on next launch I can
>    reinitialize everything.
>
>
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode




_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Android won't quit

dunbarxx via use-livecode
Well, thanks  Ralph snaky explanation, I am gonna opt out. Call it a feature "will not implement"  and tell beta testers

"This goes against Android OS. If want quit the app, use the Android "Force Quit"  

Even on iOS they have double click home and swipe up

Jacque said: "I want to wipe the app completely so that on next launch I can
reinitialize everything"

 Hmmm. Tell turn your users to "Force Quit"  in order re-init.

Ugly UI,  of course. But there are certain processes where the OS wants to re-boot.

What fight it?

BR  
 

On 6/7/18, 8:01 AM, "use-livecode on behalf of J. Landman Gay via use-livecode" <[hidden email] on behalf of [hidden email]> wrote:

    It could be solved if we had suspend and resume messages but I heard this
    is difficult to implement on Android.

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Android won't quit

dunbarxx via use-livecode
There's a pull request already, Panos was on it immediately. It will be
fixed in the next release. Apparently the problem was reintroduced
accidentally after it was fixed the first time.

Android has a swipe-to-kill also but a clean quit is better, of course. I
do understand about the complexities of the Android OS, and Ralph was right
that the problem was a null pointer.

--
Jacqueline Landman Gay | [hidden email]
HyperActive Software | http://www.hyperactivesw.com
On June 9, 2018 8:32:18 AM Sannyasin Brahmanathaswami via use-livecode
<[hidden email]> wrote:

> Well, thanks  Ralph snaky explanation, I am gonna opt out. Call it a
> feature "will not implement"  and tell beta testers
>
> "This goes against Android OS. If want quit the app, use the Android "Force
> Quit"
>
> Even on iOS they have double click home and swipe up
>
> Jacque said: "I want to wipe the app completely so that on next launch I can
> reinitialize everything"
>
> Hmmm. Tell turn your users to "Force Quit"  in order re-init.
>
> Ugly UI,  of course. But there are certain processes where the OS wants to
> re-boot.
>
> What fight it?
>
> BR
>
>
> ?On 6/7/18, 8:01 AM, "use-livecode on behalf of J. Landman Gay via
> use-livecode" <[hidden email] on behalf of
> [hidden email]> wrote:
>
>    It could be solved if we had suspend and resume messages but I heard this
>    is difficult to implement on Android.
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode




_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode