Skip to main content
October 26, 2011
Question

Android kills my app when I deactivate it

  • October 26, 2011
  • 1 reply
  • 1315 views

Hello,

I have a problem when (for example) the user receives a call or he press the home button.

I have set the DEACTIVATE and the ACTIVATE handlers and when the user for some reason "iconizes" my app, I set the systemIdleMode back to NORMAL and I show the user a "welcome back" window when he switches again on my app.

The problem is that Android keeps killing my app (not always but often) quite instantly

When it does not, I see that the CPU is used at 0.98% and RAM is about 35 Mb so I do not think it's so consuming.

Do this happens also to you?

Any hint/suggestion?

Thanks in advance

This topic has been closed for replies.

1 reply

Participating Frequently
October 26, 2011

I don't see this at all, but I tend to write only small test apps. I did see another report whcih made me wonder if Android 2.3.3 is more aggressive about shutting down background apps than previous versions.

Still, the possibility that the OS can shut down your app has to be taken into account. If the visible symptom in your app is that the "welcome back" message is displayed too frequently, perhaps you could save the time when your app deactivates and only show the welocome back message if an appropriate interval has elapsed.

October 26, 2011

HI Joe,

Thanks for your hitns, I think I've found the problem.

I try to explain it in my poor "engrish".

I think that the action of creating the "welcome back" screen is too cpu-consuming when the app is changing his state from "have focus" to "run in background mode" although I can't tell the cause (the "welcome back" screen is pretty simple, just one layer created to the top of the display list saying "game paused" with a button "Continue").

I solved the problem by not creating the "welcome back" screen when the deactivate event is triggered, but I create the "welcome back" screen when the activate event is triggered.

The user can't notice this change and the app is no longer killed by Android.

Thanks