Few days ago, I have purchased new phone, Samsung Galaxy S3, it seems to be really great phone, I bought it mostly for development purposes, such as testing my games. I found that for long period of time there was big mistake in my tutorials (and not only in mine, this issue was not noticed in many tutorial, and even professional book about andengine) which means its good to mention it.

I was teaching that its worth to close game by calling System.exit(0) on onDestroy method to make sure that our activity is actually killed (some devices tends to keep your activity alive which leads to some issues) - read more for fix.
But I discovered that on some Samsung devices (such as Galaxy S3) such approach leads to big issue, closing game straight after trying to run it! To fix it, we have to check if game is actually loaded before executing System.exit(0) Here`s proper way:

 @Override protected void onDestroy() {     super.onDestroy();              // We need to check if game is actually loaded!     if (this.isGameLoaded())     {         System.exit(0);         } } 

I just updated all my articles where it was necessary.
3/17/2013 03:29:43 pm

I also have a Galaxy S3, but only noticed it closing immediately after opening if the orientation was not the same as the one expected by the EngineOptions. Forcing it to the same orientation in the manifest fixed it, without needing the fix you suggest here.

3/28/2013 09:03:48 pm


could you make a tutorial with the digital screecontroller, which is possible to move the hero in your full game tutorial? this would be great.

Jake the dog
4/13/2013 11:49:31 pm

Hi does anyone have any idea where in the AndEngine lifecycle "isGameLoaded" gets flagged as true? In my game, I restrict all interaction(including back button but excluding home button) until onPopulate is called. Anyways great find mathew, will keep this in mind when my game gets ready for testing.


Leave a Reply.


    I am 19 years old android game developer from Poland, currently live in United Kingdom.