Page 1 of 1
Shutting down an Android App
Posted: Mon Dec 05, 2011 9:26 pm
by andyh1234
Whats the best way to let the user shut down an android app?
Ive tried a simple 'quit', but all that happens is the app closes, then when its relaunched it just shows a black screen. On further investigation, although the app appears to close when the quit is issued, it actually keeps running.
Re: Shutting down an Android App
Posted: Mon Dec 05, 2011 9:39 pm
by mwieder
Whats the best way to let the user shut down an android app?
Don't.
Not necessary, not recommended. Android apps run during the current session. Trying to close them can do weird things to system garbage collection.
Re: Shutting down an Android App
Posted: Mon Dec 05, 2011 11:46 pm
by andyh1234
Hmm, ok.
The issue I had was I have a reset app feature in the iPhone version. Its lazy, but it just deletes all the data files and then closes the app. When the user restarts it starts up like new.
It looks like I can't do the same on Android, so Ill have to wipe the files and vars etc and just call the startup routine again instead.
Re: Shutting down an Android App
Posted: Tue Dec 06, 2011 12:04 am
by mwieder
Re: Shutting down an Android App
Posted: Wed Dec 07, 2011 10:38 pm
by BarrySumpter
Thats an interesting read.
We'd need a translation into LiveCode do's n don'ts.
I'd be intersted in reading more of his posts.
Re: Shutting down an Android App
Posted: Wed Dec 07, 2011 11:22 pm
by andyh1234
And to be honest, its absolutely right.
Ive removed the quit button from the first setup screen and it already looks a lot more like an Android app!
Now I just need to work out the code to get the app to restart cleanly with all settings removed and all stacks put back to their designed state, I guess if unload all the substacks, then run the initial device detection script which will detect Android and reload the Android substack that should do the trick!
Andy
Re: Shutting down an Android App
Posted: Fri Aug 03, 2012 6:42 am
by Nick Johnson
How about this :-
Shut them down manually by navigating to Settings > Applications > Running Services. To close open apps, tap them. The hyper-efficient can also download the free version of Advanced Task Killer from the Android Market.
Re: Shutting down an Android App
Posted: Sun Aug 19, 2012 3:23 pm
by Simon
OK, now I have a real case for the Home button shutting down an app.
I made a simple "Pong" game (never done collision detection before) complete with original sound effects. Guess what happens if a user is playing the game and hits the Home button because their boss walks in the room. Yeah, they lose their jobs as the game happily plays away in their pocket.
Most users do not know the difference between hitting the Back button and hitting the Home button.
So, is their any update to trapping the Home button? Tried:
suspend
suspendStack
closeStack
shutDown
and swearing, none seem to help.
Thanks,
Simon
Re: Shutting down an Android App
Posted: Sun Aug 19, 2012 5:16 pm
by Klaus
Hi Simon,
maybe "closeStackRequest"?
Best
Klaus
Re: Shutting down an Android App
Posted: Mon Aug 20, 2012 11:58 am
by Simon
Hi Klaus,
Thanks but still no luck.
I can't be the first LC developer who uses sound fx in a twitch game.
ACK! Just thought of a workaround:
on touchStart
set playLoudness to 50
end touchstart
on touchEnd
set playLoudness to 0
end touchEnd
Oh, that is very ugly. Anybody else have an idea?
Simon