I have an Android app that worked great before I added admob activity. I close the application using the kill process (call System.exit (0)). I know this is the worst solution to complete the application. I work with OpenGL states and the libgdx framework, so I cannot fix all the memory leak that occurs when I call the standard android finish () function.
So the problem is:
My application usually works several times. I close and start it again and again. Everything works fine, but suddenly the admob view does not appear, and when I try to close, it freezes. The sound works, the last screen shows itself, but the touch does not work.
When I kill a process with the task manager, the music is still playing. Even when I completely uninstall the application, the music is still playing, so the activity is still working. It only stops when the phone restarts.
Without admob, everything works fine. I am also trying to destroy adView before closing with no result.
Here is my main activity:
public class ControllerActivity extends AndroidApplication{ private AdView adView; RelativeLayout layout; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); AndroidApplicationConfiguration cfg = new AndroidApplicationConfiguration(); cfg.useGL20 = true; cfg.useCompass = false; cfg.useAccelerometer = false; layout = new RelativeLayout(this); requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN); View gameView = initializeForView(Controller.getInstance(), cfg); adView = new AdView(this, AdSize.BANNER, "MYID"); AdRequest adRequest=new AdRequest(); adView.loadAd(adRequest); layout.addView(gameView); RelativeLayout.LayoutParams adParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); adParams.addRule(RelativeLayout.ALIGN_PARENT_TOP); adParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); layout.addView(adView, adParams); setContentView(layout); } @Override public void onDestroy() { if (adView!=null) { adView.stopLoading(); adView.destroy(); } System.exit(0); super.onDestroy(); } }
Do you have any ideas how to completely kill this process?
source share