I am reading http://developer.apple.com/library/ios/#documentation/NetworkingInternet/Conceptual/GameKit_Guide/Users/Users.html. It mentions, "Important: Games that support multitasking should take special note of this behavior. When your game moves into the background, the player may launch the Game Center application and sign out. "
How to detect when your game/app moves into background/foreground?
Thanks in advance for your help.
Unity on iOS will send OnApplicationPause to game objects when the application is put into the background, and when it comes back-- a boolean tells you which one just happened.
Here’s a C# example from one of my projects:
void OnApplicationPause(bool paused)
// Application came back to the fore; double-check authentication
I think that you just need a quick modification to the player. You need a class that receives messages from UIApplicationDelegate (it will probably make you login to view that page). You can use the
AppController class that the Unity player creates if you want. You need to respond to some of these messages:
- (void)applicationWillEnterForeground:(UIApplication *)application
- (void)applicationDidBecomeActive:(UIApplication *)application
- (void)applicationDidEnterBackground:(UIApplication *)application
These are called when the application goes from the background to active and vice-versa. What you do is up to you, but there are some different options. If you want to communicate with unity, you can pass some info with:
//I think the signature is ("Message" , "Object" , "Parameter")
//But you can check the manual to make sure.