[FIXED] Android Launcher Application keeps being destroyed


I’m developing custom launcher app containing a WebView. When I launch app as a normal app, it works without any issues, after calling startActivity()/ startActivityForResult() (Intent.ACTION_CALL, doesn’t occur when using Intent for MediaStore.ACTION_IMAGE_CAPTURE) application calls onPause(), onStop() and other activity starts, after completing its task goes back to the application. However when I set application as launcher, it calls onDestroy() right after onPause() and onStop(). Such behaviour is not desired because I’m trying to keep inserted data in the launcher WebView app.

There are also many errors in logcat right after onDestroy() similar or same as E/libGLESv2﹕ HWUI Protection: wrong calling from app context F:ES3-glDeleteBuffers (when not using it as launcher such errors appear, but sporadically and in different situations).

AppManifest contains

    android:launchMode="singleTask" >
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
        <category android:name="android.intent.category.HOME" />
        <category android:name="android.intent.category.DEFAULT" />

I also tried using singleInstance, with that mode application works correctly after installation, but breaks its behaviour after restart.

Using minSdkVersion 19, tested on Android 4.4.2.


Ok, so here’s how I managed to solve the issue, and actually what was the problem. I used

           // toRotate //Or a different ROTATION_ constant

for screen rotation, because I needed to be sure the app was running in landscape mode. The thing is, camera supports landscape mode, but dialer doesn’t. So when I launched camera it was without issues, but dialer caused portrait rotation and that caused WebView’s default behaviour when rotating the screen, onDestroy() and that causes reload afterwards…

Answered By – Lukáš Kořán

Answer Checked By – Mary Flores (Easybugfix Volunteer)

Leave a Reply

(*) Required, Your email will not be published