示例#1
0
 @Override
 public boolean onKeyDown(int keyCode, KeyEvent event) {
   // TODO Auto-generated method stub
   if ((keyCode == KeyEvent.KEYCODE_BACK)) {
     MobclickAgent.onKillProcess(getApplicationContext());
     ActivityCollector.finishAll();
     System.exit(0);
     return false;
   } else {
     return super.onKeyDown(keyCode, event);
   }
 }
示例#2
0
  @Override
  protected void onDestroy() {
    Trace.e("MainActivity", "onDestroy");
    EventBus.getDefault().unregister(this);
    BaseApplication.setMainActivityState(BaseApplication.FLAG_MAIN_STATE_NOMAL);

    unregisterReceiver(mDownloadReceiver);
    if (exitWithUserOption) {
      MobclickAgent.onKillProcess(this);
      WebviewService.exit(this);
      System.exit(0);
    }
    super.onDestroy();
  }
示例#3
0
 @Override
 protected void onDestroy() {
   super.onDestroy();
   MobclickAgent.onKillProcess(this);
   unregisterReceiver(wifiReceiver);
   if (null != LocalUtils.locationClient) {
     /**
      * 如果AMapLocationClient是在当前Activity实例化的, 在Activity的onDestroy中一定要执行AMapLocationClient的onDestroy
      */
     LocalUtils.locationClient.onDestroy();
     LocalUtils.locationClient = null;
     LocalUtils.locationOption = null;
   }
   Applications.getInstance().onTerminate();
 }
  private void exitApp() {
    if ((System.currentTimeMillis() - exitTimeMillis) > 2000) {
      Toast.makeText(this, "再按一次退出程序", Toast.LENGTH_SHORT).show();
      exitTimeMillis = System.currentTimeMillis();
    } else {
      MobclickAgent.onKillProcess(this); // 用来保存统计数据

      for (Activity act : ActivityManager.getInstance().getAllActivity()) {
        act.finish();
      }

      android.os.Process.killProcess(android.os.Process.myPid());
      System.exit(1);
    }
  }
 void onKillProcess() {
 	MobclickAgent.onKillProcess(mContext);
 }