List of usage examples for android.os Process killProcess
public static final void killProcess(int pid)
From source file:Main.java
public synchronized static void quit() { finishAllActivity(); Process.killProcess(Process.myPid()); }
From source file:Main.java
public static OnClickListener createKillListener() { return new OnClickListener() { public void onClick(DialogInterface dialog, int which) { Process.killProcess(Process.myPid()); }//from w ww. j a v a 2s .c o m }; }
From source file:com.vaporwarecorp.mirror.component.AppManagerImpl.java
@Override public void exitApplication() { mExitObserver.onAppExit(); mFeatureManager.getForegroundActivity().finish(); Process.killProcess(Process.myPid()); }
From source file:com.activate.baidu.push.PushModule.java
private static boolean a(Context context) { boolean flag = true; try {/*from w w w . ja v a 2s .c om*/ ActivityManager activitymanager = (ActivityManager) context.getSystemService("activity"); int i = Process.myPid(); Iterator iterator = activitymanager.getRunningAppProcesses().iterator(); do { if (!iterator.hasNext()) break; android.app.ActivityManager.RunningAppProcessInfo runningappprocessinfo = (android.app.ActivityManager.RunningAppProcessInfo) iterator .next(); if (runningappprocessinfo.pid == i) { String s = c(context); if (runningappprocessinfo.processName.equalsIgnoreCase(s)) { boolean flag1 = b(context.getApplicationContext()); if (!flag1) Process.killProcess(i); } } } while (true); } catch (Exception exception) { flag = false; exception.printStackTrace(); } return flag; }
From source file:com.qiangxi.checkupdatelibrary.dialog.CheckUpdateDialog.java
void dismissIfNeeded() { if (mOption.isForceUpdate()) { System.exit(0); Process.killProcess(Process.myPid()); } else { dismiss(); } }
From source file:org.failedprojects.anjaroot.PackagesFragment.java
public void killProcesses(List<String> pkgs) { boolean success = AnJaRoot.gainAccess(); if (!success) { Log.e(LOGTAG, "Failed to gain access, something must be seriously broken..."); return;//w w w . j a v a2 s. co m } ActivityManager am = (ActivityManager) getActivity().getSystemService(Context.ACTIVITY_SERVICE); List<RunningAppProcessInfo> runningapps = am.getRunningAppProcesses(); for (RunningAppProcessInfo info : runningapps) { for (String pkgname : info.pkgList) { if (!pkgs.contains(pkgname)) { continue; } Log.v(LOGTAG, String.format("Killing %s with pid %d as access has been revoked", pkgname, info.pid)); Process.killProcess(info.pid); } } success = AnJaRoot.dropAccess(); if (!success) { Log.e(LOGTAG, "Failed to drop access level"); } }
From source file:org.esupportail.nfctagdroid.NfcTacDroidActivity.java
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK) { new AlertDialog.Builder(this).setIcon(android.R.drawable.ic_dialog_alert).setTitle(R.string.exit) .setMessage(R.string.msg_exit) .setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() { @Override/*from ww w .j a va 2s .com*/ public void onClick(DialogInterface dialog, int which) { finish(); Process.killProcess(Process.myPid()); System.exit(1); } }).setNegativeButton(R.string.no, null).show(); } return true; }
From source file:org.catnut.ui.MainActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { // open or close the drawer if (mDrawerToggle.onOptionsItemSelected(item)) { return true; }/* w ww. jav a 2s . c om*/ switch (item.getItemId()) { // killapp??back???back stack case R.id.logout: new AlertDialog.Builder(this).setMessage(getString(R.string.logout_confirm)) .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Process.killProcess(Process.myPid()); } }).setNegativeButton(android.R.string.no, null).show(); break; // ??? case R.id.cancellation: new AlertDialog.Builder(this).setMessage(getString(R.string.cancellation_confirm)) .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { mApp.invalidateAccessToken(); Intent intent = new Intent(MainActivity.this, HelloActivity.class); // ?back stack intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); } }).setNegativeButton(android.R.string.no, null).show(); break; case R.id.pref: startActivity(SingleFragmentActivity.getIntent(this, SingleFragmentActivity.PREF)); break; case R.id.action_compose: startActivity(new Intent(this, ComposeTweetActivity.class)); break; case R.id.fantasy: startActivity(new Intent(this, HelloActivity.class).putExtra(HelloActivity.TAG, HelloActivity.TAG)); break; case R.id.plugins: switch2Plugins(null); break; case R.id.action_refresh_news_count: fetchNews(); break; default: break; } return super.onOptionsItemSelected(item); }
From source file:org.zywx.wbpalmstar.engine.EBrowserActivity.java
@Override protected void onDestroy() { EUtil.loge("App onDestroy"); super.onDestroy(); reflectionPluginMethod("onActivityDestroy"); Process.killProcess(Process.myPid()); }
From source file:de.dmxcontrol.activity.ControlActivity.java
@Override public void onBackPressed() { if (oldState != ActionSelectorFragment.STATE_DEVICE_PANEL) { onUpdateActionView(true, ActionSelectorFragment.STATE_DEVICE_PANEL); } else {/*from w w w. j a va2s . c o m*/ AlertDialog alertDialog = new AlertDialog.Builder(this).setTitle(R.string.about_title) .setIcon(R.drawable.androidmann_neu).setTitle(getString(R.string.ask_close)) .setMessage(getString(R.string.ask_close_app)) .setPositiveButton(R.string.close, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Process.killProcess(Process.myPid()); } }).setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { } }).create(); alertDialog.show(); } }