iDevGames Forums
A method for when someone texts during the game is running? - Printable Version

+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: iPhone, iPad & iPod Game Development (/forum-11.html)
+--- Thread: A method for when someone texts during the game is running? (/thread-170.html)



A method for when someone texts during the game is running? - MrPenguin9 - Apr 10, 2010 12:01 PM

I've been making a game and I'm wondering, is there a method for when someone texts or something else pops up that disrupts during when the game is running? (I want it to pause the game) Right now when someone texts during the game it still runs behind the text alert.

Thanks! Grin


A method for when someone texts during the game is running? - Frank C. - Apr 10, 2010 12:20 PM

Look up applicationWillResignActive and applicationDidBecomeActive in the docs.


A method for when someone texts during the game is running? - MrPenguin9 - Apr 11, 2010 01:57 PM

Frank C. Wrote:Look up applicationWillResignActive and applicationDidBecomeActive in the docs.

THANK YOU!! Grin


A method for when someone texts during the game is running? - Rasterman - Apr 12, 2010 07:30 AM

I was wondering why they don't put any of this into the simulator, or is there a secret way to test it on the simulator?


A method for when someone texts during the game is running? - ThemsAllTook - Apr 12, 2010 11:03 AM

Rasterman Wrote:I was wondering why they don't put any of this into the simulator

Presumably a combination of limited development resources at Apple, and a desire to encourage developers to test on real devices. The simulator is not an emulator; it's a relatively thin software layer that essentially lets you run a Mac application in an iPhone-like context. A full-blown iPhone emulator could give you a higher-fidelity representation of how software would run on a real device, but it would be much slower to execute on the Mac, and a much larger development effort for Apple.


A method for when someone texts during the game is running? - bmantzey - Apr 13, 2010 09:32 PM

Yes, there is a way to test this in the Simulator. Command-L will simulate locking the device. When you lock the device, it also calls applicationWillResignActive. Sliding the unlock bar invokes applicationDidBecomeActive.

It's smart to handle those messages because they are invoked for many reasons like when you get a low battery warning, receive a phone call on iPhone, the device times out from inactivity, and several other reasons.

Cheers!