6

I have found very strange bug with any of the Android application, when we are installing the application in Android Device with given flow.

  1. Unistall the app if already installed.
  2. Download the app(.apk file) and keep in SD card
  3. Double click on the .apk file and tap on “Install” on Installation window
  4. In confirmation popup, tap on “Open” button (Please do not tap on “Done”)
  5. Now App will open then visit to some other activities ( In my case say...Splash ---> Login--> Home screen ).
  6. Now tap on the device Home button, it take me to the device main screen.
  7. Now if i again tap on the launcher icon, my app starts from the 1st screen ( i.e. Splash ). While it should display my app Home page.

Also in STEP: 4 if i choose Done option, then launching my application, then it is working fine.

is it an Android OS related bug? or am I doing something wrong?

Any suggestion in this regard really appreciated.

Thanks HImanshu

Himanshu
  • 1,066
  • 6
  • 19
  • 44
  • What is the launcher activity in your manifest? I can only assume it's the splash in case you dont check for logged in users you will be taken to that activity every time the app launches – crazyPixel Apr 05 '14 at 11:07
  • Hi @crazyPixel: yes launcher activity is Splash, but application should retain its state, whenever we stop application (after using it) with device home button. It must not launch from the splash, the launcher activity. – Himanshu Apr 05 '14 at 12:20
  • Hi @Himanshu I only now understood what you meant in your question - I thought It starts from the splash after closing the application (also from background) post some code if you need any further help – crazyPixel Apr 05 '14 at 14:37
  • Hi @crazyPixel Thanks for your response, can you please try the above given steps for any apk in any Android device at your end (exactly in Same manner)...so you will get idea, what i am saying. I appreciate for you help! – Himanshu Apr 07 '14 at 06:56
  • Hi @crazyPixel Thanks for your response, can you please try install an Apk in Android device with the given steps (in same manner), You will see what i am trying to say actually. – Himanshu Apr 07 '14 at 12:17
  • I'm having the same issue. Have you solved this? – Oleg Filimonov Nov 30 '16 at 13:32
  • @OlegFilimonov: Nope! its still open. – Himanshu Dec 14 '16 at 04:55
  • @Himanshu I actually solved this in my case. I've posted an answer – Oleg Filimonov Dec 14 '16 at 10:03
  • @OlegFilimonov: Great thanks! will check this and let you know...and will accept your answers if it is work for me. – Himanshu Dec 14 '16 at 10:40

2 Answers2

2

I solved this with adding this code in SplashActivity's onCreate:

 if (!isTaskRoot()
                && getIntent().hasCategory(Intent.CATEGORY_LAUNCHER)
                && getIntent().getAction() != null
                && getIntent().getAction().equals(Intent.ACTION_MAIN)) {

            finish();
            return;
        }

If anyone can find source of this, please let me know - I can't find the original answer I got this from.

Oleg Filimonov
  • 1,323
  • 4
  • 13
  • 36
  • This works fine, but when you you have your app minimized and at the same time you try to open your app from play store, it will not opened. – Nayan May 10 '17 at 07:15
0

post your splash activity code. usually the practice is you should set flags on splash activity so that it only appears if the application is starting from scratch or if we say there is no saved instance of activity in the android. I have never tried the way you are saying (tapping 'open' but not 'done' etc.) Following is the splash activity code for my app it might be usufull to you,

 new Handler().postDelayed(new Runnable() {

        @Override
        public void run() {

            Intent intent = new Intent(Spash_activity.this,
                    MainActivity.class);
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
            intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
            startActivity(intent);
        }
    }, TIME_OUT);
madteapot
  • 2,208
  • 2
  • 19
  • 32