Recently encountered a problem in the project, the user first installs the application in the System Installer installation completion interface has "done" and "open" two buttons.
When the user clicks the "Open" button to enter the user registration page for mobile phone number verification code to send and verification code input and other operating interface, if the user click the Home button to apply to the desktop, and then click the application icon from the desktop to try to cut back to the application to complete the verification code input, etc., the application re-walked the Welcome page Before this time from the installation of the system to finish the screen click on the launch of the application is actually still running behind.
However, when the user "completely quits" the app, either by tapping the "Finish" button on the installation Completion screen and starting from the desktop, or by clicking on the "Open" button before the app is "Overwrite Installation", the application will not "start multiple times".
After looking also tried many kinds of methods, set activity of Launchmode and so on can not solve this problem, nonsense said, on the solution.
In fact, the reason is very simple, using the program installer to open the program, the launch of the intent is not with category, and our own open the program is with the category, so only need in the configuration Intent.action_ There is no category under the activity judgment of main. And then put in the notification bar when you want to have no category to generate a startup intent.
if ((Getintent (). GetFlags () & intent.flag_activity_brought_to_front)! = 0) { finish () ; return ;}
Add the above judgment in the OnCreate method of the application settings <action android:name= "Android.intent.action.MAIN"/> Application entry activity, Perfect solution for multiple restarts of applications.
Special Acknowledgement:
http://bbs.csdn.net/topics/390201703
Http://www.2cto.com/kf/201407/319948.html
Android App first install successful click "Open" after the home key to cut out the app and then click on the desktop icon back to cause app restart problem