Delay When Starting App Up After Closing It

My friend is testing my app on a Nexus 4 handset and reports that when the app is closed and reopened, it shows a black screen for around 4-5 seconds before showing the app where it left off where other applications resume instantly. 

I don’t have anything setup for resume system events, and it works fine on iOS.

Is there anything I can do to either disable multitasking or speed up the application resuming? 

Hi @CraftyDeano,

Is there anything that would “intentionally” cause this, like a processor-taxing routine that’s running during the system “applicationResume” event? What is the relative power of the Nexus4 handset… i.e. overall processor power compared to other Android devices?

Regards,

Brent

Hi Brent,

There is nothing taxing on the applicationResume event, I don’t actually use it. 

The Google Nexus 4 is quite a highend device, launched late last year with a powerful CPU/GPU and runs OS v4.2. 

To give an example, there is around 20 display objects on screen with 5 touch listeners on my main menu. 

My friend tested with very intensive 3d games which open up instantly from being closed.

It’s not a major issue im facing, as this is my first time developing for android, I didn’t know if this was common with Corona, or if anyone else had this issue (i couldnt find any forum posts about it).

If possible, I would like to disable multitasking on Android as a work around, so it boots fresh everytime, but I don’t think thats possible from the lack of search results. 

+1 for a full shut down of the app when the back button is pressed.

Simple, call 

native.requestExit()

 when the back button is pressed :slight_smile:

@CraftyDeano thanks for the suggestion.

I’ve just added it to my project and it doesn’t perform a full app shut down, it performs the same as if I hadn’t added  native.requestExit().

The app closes, but there is still activity retained on the phone. It’s only when I go into the phone settings and clear the memory or use the menu button to exit that the app fully closes. Back button doesn’t seem to fully release some activities  (webview and inmobi ads are the ones I’ve discovered so far).

Did this call work to remove your 4-5 second lag on restart?

Hmm, sounds like it doesn’t force the app to close then, rather just minimize it. I compressed a lot of my images and got it down to around 2-3 seconds, which is acceptable. 

Instead of native.requestExit() try os.exit() - that should force it to shutdown completely*.

*According to the API docs!

@CraftyDeano

Thanks!!! That’s sorted it. It takes around 8 seconds to close with os.exit(), but it does clear the webview and when I restart the app the ads are successfully called again.

It seems like native.requestExit acts as some kind of halfway house between suspending the app and completely shutting it down.

Again, thanks for your help on this.

Hi @CraftyDeano,

Is there anything that would “intentionally” cause this, like a processor-taxing routine that’s running during the system “applicationResume” event? What is the relative power of the Nexus4 handset… i.e. overall processor power compared to other Android devices?

Regards,

Brent

Hi Brent,

There is nothing taxing on the applicationResume event, I don’t actually use it. 

The Google Nexus 4 is quite a highend device, launched late last year with a powerful CPU/GPU and runs OS v4.2. 

To give an example, there is around 20 display objects on screen with 5 touch listeners on my main menu. 

My friend tested with very intensive 3d games which open up instantly from being closed.

It’s not a major issue im facing, as this is my first time developing for android, I didn’t know if this was common with Corona, or if anyone else had this issue (i couldnt find any forum posts about it).

If possible, I would like to disable multitasking on Android as a work around, so it boots fresh everytime, but I don’t think thats possible from the lack of search results. 

+1 for a full shut down of the app when the back button is pressed.

Simple, call 

native.requestExit()

 when the back button is pressed :slight_smile:

@CraftyDeano thanks for the suggestion.

I’ve just added it to my project and it doesn’t perform a full app shut down, it performs the same as if I hadn’t added  native.requestExit().

The app closes, but there is still activity retained on the phone. It’s only when I go into the phone settings and clear the memory or use the menu button to exit that the app fully closes. Back button doesn’t seem to fully release some activities  (webview and inmobi ads are the ones I’ve discovered so far).

Did this call work to remove your 4-5 second lag on restart?

Hmm, sounds like it doesn’t force the app to close then, rather just minimize it. I compressed a lot of my images and got it down to around 2-3 seconds, which is acceptable. 

Instead of native.requestExit() try os.exit() - that should force it to shutdown completely*.

*According to the API docs!

@CraftyDeano

Thanks!!! That’s sorted it. It takes around 8 seconds to close with os.exit(), but it does clear the webview and when I restart the app the ads are successfully called again.

It seems like native.requestExit acts as some kind of halfway house between suspending the app and completely shutting it down.

Again, thanks for your help on this.