The Android App has to load the welcome page every time

The problem is:
After installing the apk package sent by QQ, open the application through the open button of the installation interface, and whenever the application switches from the background to the foreground, the welcome interface will be launched. If it is started by clicking the app, there is no such problem.
Solution:
Add the following code in the onCreate() method of the startup interface:

 if ((getIntent().getFlags() & Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT) != 0) {
            finish();
            return;
        }


This problem is solved by the above code.

The reasons for this problem are:

  1. Whenever you click the open button and click the icon to start,
  2. Intent parameters are not the same
  3. This leads to a different way of starting the activity,
  4. Which leads to the above problems   
  • Every time the app is opened through a third-party path, there is also a cache that wakes up the start page of the app
  • Turn off the application and re-open the app through the application icon.

    Of course, the app that we download from the market and wake up through the application icon will not have this problem. Record it

Guess you like

Origin blog.csdn.net/weixin_40611659/article/details/108697239