Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

App is reopening all time from the splash screen

I have an issue in my app only for the specific device only when I am clicking on the home button after performing the few steps in my app, soo app is in the recent tabs. If I will open the app from the recent tabs then it will open from the last page where I drop the app last, but if I will click on the app icon instead of recent tabs then the app will open from the splash screen.

This will happen only for the one Samsung device and other apps were working fine for the same device.

Please do help me if anyone faced the same issue.

like image 639
Kishan sharma Avatar asked Feb 03 '26 15:02

Kishan sharma


1 Answers

I did face the same issue in the past and that too with a Samsung device.

The solution(may be temporary fix for you as I did not test it on other models of Samsung) which worked in my case is to write below code in the onCreate() of the initial/launch Activity:

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

        finish();
        return;
    }
like image 111
Nike15 Avatar answered Feb 06 '26 05:02

Nike15



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!