最近踩坑,发现之前通过execCmd执行重启APP的adb命令失效了,最后找到的解决方案:
Intent intent = getBaseContext().getPackageManager().getLaunchIntentForPackage(getBaseContext().getPackageName());
intent.addFlags(
Intent.FLAG_ACTIVITY_NEW_TASK
| Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_CLEAR_TASK
);
startActivity(intent);
android.os.Process.killProcess(android.os.Process.myPid());
System.exit(0);
日常遇到的小坑,在此记录一下