Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I believe the reason is because the application is not considered as suspended. In normal objective c programming it means that <strong>applicationWillResignActive</strong> is called when the user double clicks on the home button. So what you want to do is to add that code for this part.</p> <p>Here is a flow of events: <a href="http://www.cocoanetics.com/2010/07/understanding-ios-4-backgrounding-and-delegate-messaging/" rel="nofollow">http://www.cocoanetics.com/2010/07/understanding-ios-4-backgrounding-and-delegate-messaging/</a></p> <p>Corona seems to have these events:</p> <ul> <li><p>"applicationStart" occurs when the application is launched and all code in main.lua is executed.</p></li> <li><p>"applicationExit" occurs when the user quits the application.</p></li> <li><p>"applicationSuspend" occurs when the device needs to suspend the application such as during a phone call or if the phone goes to sleep from inactivity. In the simulator, this corresponds to the simulator running in the background. During suspension, no events (not even enterFrame events) are sent to the application while suspended, so if you have code that depends on time, you should account for the time lost to an application being suspended.</p></li> <li>"applicationResume" occurs when the application resumes after a suspend. On the phone, this occurs if the application was suspended because of a phone call. On the simulator, this occurs when the simulator was in the background and now is the foreground application.</li> </ul> <p>So my guess is that you have to implement it outside of the corona API.</p> <p>According to the corona documents you can implement them in the delegate:</p> <blockquote> <p>You can intercept UIApplicationDelegate events via your implementation of the CoronaDelegate protocol.</p> <p>This protocol conforms to the UIApplicationDelegate protocol. Corona's internal delegate will call your protocol's method if it is implemented.</p> <p>Please keep in mind the following:</p> <p>Methods that Apple has deprecated will be ignored. In most cases, your class' version will be invoked after Corona's corresponding version of the UIApplicationDelegate method. There is one situation in which your version will be called before. In situations where the app is about to suspend or go to the background, your method will be called before Corona's version, e.g. applicationWillResignActive: and applicationDidEnterBackground:.</p> </blockquote> <p><a href="http://docs.coronalabs.com/native/enterprise/ios/CoronaDelegate.html" rel="nofollow">http://docs.coronalabs.com/native/enterprise/ios/CoronaDelegate.html</a></p> <p>But this is just a guess. Hope it helps!</p> <p>Edit: </p> <p>I was thinking, something really simple you could do is catch it outside and present a "pause" screen, then just hide it when the application enters foreground.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload