1) KILLING THE TASKS AND KEEPS THE APPLICATION PACKAGE TO RESTART
ActivityManager am = (ActivityManager) Tracking.this.getSystemService(ACTIVITY_SERVICE);
List<ActivityManager.RunningTaskInfo> taskInfo = am.getRunningTasks(1);
ComponentName componentInfo = taskInfo.get(0).topActivity;
am.restartPackage(componentInfo.getPackageName());
2) Calling Home Activity
Intent in = new Intent(Intent.ACTION_MAIN);
in.addCategory(Intent.CATEGORY_HOME);
in.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
in.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
startActivity(in);
3)
System.exit(0);
4) Killing the Process by id
android.os.Process.killProcess(android.os.Process.myPid());
No comments:
Post a Comment