Whether the mobile phone itself has the setting of not retaining activities, you can check it in the developer options first, and then check the related security management software of Xiaomi to compare whether the same situation exists in other software.
Troubleshooting method, first test with other software to see if the same problem will occur. If not, check whether our current interface has destroyed the application in the life cycle method, such as System.exit(0) Let's wait and troubleshoot the problem.
1. If such a weird problem occurs, you should first check if other apps have similar problems. If so, it is a problem with the desktop app, go to 1.1; if not, go to 2;
1.1. Re-download a desktop application, try again, and analyze where the pitfalls are;
2. Check the code and XML configuration, especially AndroidManifest.xml, to see if parameters are declared that should not be declared.
Whether the mobile phone itself has the setting of not retaining activities, you can check it in the developer options first, and then check the related security management software of Xiaomi to compare whether the same situation exists in other software.
Troubleshooting method, first test with other software to see if the same problem will occur. If not, check whether our current interface has destroyed the application in the life cycle method, such as System.exit(0) Let's wait and troubleshoot the problem.
1. If such a weird problem occurs, you should first check if other apps have similar problems. If so, it is a problem with the desktop app, go to 1.1; if not, go to 2;
1.1. Re-download a desktop application, try again, and analyze where the pitfalls are;
2. Check the code and XML configuration, especially AndroidManifest.xml, to see if parameters are declared that should not be declared.
This problem should occur during the first installation, right?
Add the following code to your launchActivity onCreate method:
Hope this helps you!