More common in Huawei mobile phones
such as Huawei P30
1. Add the following method to the base class BaseActivity:
@Override
public boolean moveTaskToBack(boolean nonRoot) {
return super.moveTaskToBack(true);
}
2. Add code judgment in oncreate of App's startup page:
if (!this.isTaskRoot()) {
Intent mainIntent = getIntent();
String action = mainIntent.getAction();
if (mainIntent.hasCategory(Intent.CATEGORY_LAUNCHER) && Intent.ACTION_MAIN.equals(action)) {
finish();
return;
}
}
Generally, it can solve the problem of reloading each time the app enters when more than 90% of the app processes occupy a large amount.
Scenario: The user jumps out through the notification bar or the Home button (checking text messages, etc.) and re-enters the app reloading problem.