A method for when someone texts during the game is running?

Apprentice
Posts: 16
Joined: 2010.01
Post: #1
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
Quote this message in a reply
Member
Posts: 446
Joined: 2002.09
Post: #2
Look up applicationWillResignActive and applicationDidBecomeActive in the docs.
Quote this message in a reply
Apprentice
Posts: 16
Joined: 2010.01
Post: #3
Frank C. Wrote:Look up applicationWillResignActive and applicationDidBecomeActive in the docs.

THANK YOU!! Grin
Quote this message in a reply
Member
Posts: 81
Joined: 2007.07
Post: #4
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?
Quote this message in a reply
Moderator
Posts: 1,560
Joined: 2003.10
Post: #5
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.
Quote this message in a reply
Member
Posts: 241
Joined: 2008.07
Post: #6
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!
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Indian Scammer Nipin P selling MowglyRun - Endless Running Game ipodster 0 1,463 Jul 9, 2013 04:01 AM
Last Post: ipodster