Page 1 of 1

How to handle the home key on Android

Posted: Wed Jan 24, 2018 8:44 pm
by sphere
Hi,

since there is no command or handler available for the homeKey (the circle on many Android phones) and probably the same as the button...the app is not closed after tapping it. (so not the backKey or the menuKey)
I see app's who are really closed when tapping on that key, especcially banking apps.

I want that too, and not that the app stays open in memory.
It's ok for many apps, but for this app i want it to close.

How to do that.
Thanks for any help.

Sphere.

Re: How to handle the home key on Android

Posted: Thu Jan 25, 2018 12:32 pm
by MaxV
Did you try this?

Code: Select all

on iconifyStack
 close this stack
end iconifyStack

Re: How to handle the home key on Android

Posted: Thu Jan 25, 2018 5:57 pm
by FourthWorld
Does the iconifyStack message get sent when going to the background on Android?

Re: How to handle the home key on Android

Posted: Thu Jan 25, 2018 7:47 pm
by jacque
No, iconifyStack is desktop only. As far as I know there's no workaround for the problem because there are no messages to trap. The app has no way of knowing that it's in the background. This has caused me some trouble too and I haven't been able to solve it.

Re: How to handle the home key on Android

Posted: Thu Jan 25, 2018 8:58 pm
by sphere
Sorry MaxV according Jacque it's desktop only, thanks anyway.

Isn't it a matter that it could/should/has to be added to the LC engine, so it can be detected just at the moment of tapping like the backKey and then do something with it via a handler?

So perhaps as feature request?
I wonder how those other apps handle it.
Probably depending how and with what they are written.

Re: How to handle the home key on Android

Posted: Thu Jan 25, 2018 10:39 pm
by jacque
It's been an issue for a while now, there is a discussion in a bug report here:
http://quality.livecode.com/show_bug.cgi?id=20456

It doesn't directly address your question but the info is related. The bug has been "under review" for a few months so if you add a comment maybe they'll notice and take another look.

Re: How to handle the home key on Android

Posted: Fri Jan 26, 2018 9:33 am
by sphere
Thanks, i've added some comments to that report.