[Resolved] App Suspend Mode question.

A. Is there a way to create an os.exit timer when your app is suspended?
B. Is there an event when another app starts up?

A: While suspended your app will never os.exit on its own. I would like create a 10-20 minute timer and os.exit.

B: I did a test on my IPad started Angry Birds Space then launched my app. Angry Birds Space shuts down while my app stars up. I suspend my app and start Angry Birds Space my app gets no events to shut down.

Thx, Darkmod [import]uid: 7177 topic_id: 26409 reply_id: 326409[/import]

I do not believe launching another app should send any kind of event to your own app.

Calling os.exit() is actually not something you should be doing; the idea of the dock is to allow for multitasking. (Os.exit() will get your app rejected by Apple.)

Do you have a special reason you want the app to quit itself? [import]uid: 52491 topic_id: 26409 reply_id: 107170[/import]

What would be the correct way of shutting down/restarting your app. [import]uid: 7177 topic_id: 26409 reply_id: 107173[/import]

Why dont you set

[lua]iphone =
{
plist =
{
UIApplicationExitsOnSuspend = true,

}
}[/lua]
in config.lua [import]uid: 64174 topic_id: 26409 reply_id: 107175[/import]

I am well aware of UIApplicationExitsOnSuspend. I don’t want to exit on Suspend. There are a lot of events that trigger this, taking phone calls, loading Game Center, loading OpenFient and apples main button. Flagged as true basically disables the multitasking tasking.

[import]uid: 7177 topic_id: 26409 reply_id: 107179[/import]

The “correct” way is either setting that flag to true (as Satheesh said) or by letting the user quit it from the dock; that’s it.

If you want the app to restart (NOT quit) you could have a function listening for a resume event and then switch back to the menu/splash immediately if the app had been closed for X amount of time.

Is that an option here? [import]uid: 52491 topic_id: 26409 reply_id: 107359[/import]

Thanks for the info peach.

I did some more testing on the iphone/ipad. So when an app is in a suspend state and a new app is launched requiring more memory the suspend app will automatically shut down. I was thinking I had to handle this event manually. So I have no need for an exit timer or handling the exit state.

One thing I failed to notice “apple” apps/games: Exit options do not exist in the UI. So I need to do an Android check for my exit button UI.

My next question would be is os.exit safe to use on the Android device?

Thx, Darkmod
[import]uid: 7177 topic_id: 26409 reply_id: 107423[/import]

Apparently os.exit is like killing the app on Android. The recommended method is to use native.requestExit

https://developer.anscamobile.com/forum/2012/01/13/osexit-command-makes-simulator-crash [import]uid: 64174 topic_id: 26409 reply_id: 107516[/import]

Shouldn’t that UIApplicationExitsOnSuspend = true be set in build.settings, not config.lua?

Also, I’ve added this to my build.settings, and now my app restarts when I relaunch after the home button press, but it never leaves the task bar after the home button press. Is this what is expected? [import]uid: 58455 topic_id: 26409 reply_id: 110560[/import]

Hey Dave,

Yes, it should be, though hopefully people will know what was meant from the other code posted :wink: Good eyes.

RE the app being kept in the bar, that is expected, yes. Apple’s multitasking demands it and users are accustom to it.

Peach :slight_smile: [import]uid: 52491 topic_id: 26409 reply_id: 110600[/import]

Thanks, peach. [import]uid: 58455 topic_id: 26409 reply_id: 110667[/import]

I recently applied for nook developer and I was testing my games on my nook color. Everthing worked fine out of the box. The problem is the resumeOnSuspend is not working on nook, at least the example given earlier in this post. Question is, is there a way in android/nook to do the same?

thanks
[import]uid: 12407 topic_id: 26409 reply_id: 113422[/import]