Posted: 7th Sep 2011 16:09
I was wondering - what support does AppGameKit have for being "interrupted" especially when running on mobile devices (ie, pressing "Home" on iOS devices or getting a call on an phone).

Also is AppGameKit enabled for "multitasking" or background suspension when fast-app switching is used on iOS4+
Posted: 9th Sep 2011 0:01
I was wondering - what support does AppGameKit have for being "interrupted" especially when running on mobile devices (ie, pressing "Home" on iOS devices or getting a call on an phone).

These are good question, very interested in the response.
Posted: 9th Sep 2011 8:09
While I'm running a program through the player on my iPad, pressing the home button pauses the program, and when I go back to it, it starts running again. Same thing when I flip the cover on it, it's paused until I open the cover up again.

Hmmmm, I'm not sure it's REALLY paused, I guess I'll make a clock display and try it.
Posted: 9th Sep 2011 9:18
yes it's paused
Posted: 9th Sep 2011 10:52
But is there some kind of notification event so you can know when your app is exited on the IOS player so you can save state etc?
Posted: 9th Sep 2011 15:58
Mobile devices usually have some kind of notification to tell the application that it is going to background, or it is going to be closed, battery low, etc...

I'm also interested on that. For example, a good game behaviour is not only pausing when going to background, but also show the "Pause Screen", so the user is not take on surprise when the game goes back active.

I believe these kind of events are pretty much the same on all mobile devices, with different implementations, of course.

Cheers
Posted: 11th Sep 2011 0:17
If someone can recreate a situation with the current version which loses game states during a phone call / pause event / etc then please post it to the issues board so we can reproduce it and deal: http://code.google.com/p/agk/issues/list
Posted: 11th Sep 2011 1:22
its not about loosing data rather about being told *when* the interruptions happen so data / states can be saved etc.

Regardless of the pause behaviour it'd be nice to know when someone actually exits your app
Posted: 11th Sep 2011 3:54
The idea is that AppGameKit 'freezes' the state of your entire app when the device goes elsewhere, so there is no need for your app to handle this (making it easier for everyone). Currently there is no built in way to detect the exit trigger in T1 and T2, but you can add this with a little knowledge to the T2 side of things. There is no mechanism for a callback in T1, so being able to run code the moment the app is terminated is not possible (though I can see the need for this). Ideas welcome, but remember this is BASIC not C++, so concepts such as callbacks or interupts go beyond the simple sequential nature of T1.
Posted: 12th Sep 2011 13:04
Ah I see - thanks for the info.
Posted: 12th Sep 2011 18:49
Lee,
Any extra control that we can be given in T1 is very much welcomed. The thing about having it so we can detect if say the application goes to a paused state that when the application is resumed we can prepare the player to continue playing. Ether popping up a menu or doing a count down.
This is a feature request that is very much needed.
Posted: 12th Sep 2011 19:16
You should be able to do this two ways using Tier2 in Xcode.

You can capture notifications by adding -applicationDidEnterBackground: method in your application delegate or by registering for the UIApplicationDidEnterBackgroundNotification in your view controllers.

I have not tested this, but it should work.
Posted: 12th Sep 2011 23:26
What about phones with multitasking capabilities? what happens when another application gets in the front, and your game app is in the background?