"renojim" wrote:
I'm not sure it matters, but is there any amount time after the Home button is pressed to do anything, or is it pretty much an arbitrary amount of time? Is it possible to have an isHomeButton() event to do some last minute things, or do you think that opens the door for another way for badly behaving apps to screw things up?
I second that some sort of cleanup handler, with a set amount of time to act before forcibly killed, would be useful. Equating this to UNIX signals it could work like this:
Set an alarm, send a normal kill signal (catchable) to the process
If alarm is hit, forcibly kill (uncatchable signal) the process
If app returns before alarm, remove alarm and continue
If home is pressed again while alarm is active, immediately forcibly kill and remove alarm
Focus would stay with the app until it relinquished control or was forcibly killed, and it's in the developer's best interest and the best practice to display a notice on the screen that the application is cleaning up/saving state if you catch the exit signal. Any time an app catches the exit signal but does not relinquish control (that is, whenever an app has to be forcibly killed), a notification on the home screen by the system that the previous application did not exit cleanly would be useful. This helps enforce best practices by developers and curb bad practices by users (such as always pressing home twice if certain apps take a bit longer to relinquish control).
That would allow developers to correctly apply cleanup/sync routines on exit, while retaining both the ability forcibly stop applications and keep the home screen clean.
-Kevan
-- GandK Labs
Check out Reversi! in the channel store!