//解决切换别的应用,返回此应用,重新启动的问题
在splash onCreate 添加
if (!isTaskRoot()) {
finish();
return;
}
/**
- 设置使用小米手机刘海屏区域
*/
private void setMIUINotch() {
int flag = 0x00000100 | 0x00000200 | 0x00000400;
try {
Method method = Window.class.getMethod("addExtraFlags", int.class);
method.invoke(getWindow(), flag);
} catch (Exception e) {
Log.i("launch", "addExtraFlags not found.");
}
}