Java Code Examples for com.umeng.analytics.MobclickAgent#onKillProcess()

The following examples show how to use com.umeng.analytics.MobclickAgent#onKillProcess() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MainActivity.java    From Huochexing12306 with Apache License 2.0 6 votes vote down vote up
public void quit() {
	MobclickAgent.onKillProcess(this);
	MyApp myApp = ((MyApp)getApplication());
	L.i("isAntiTheftServiceStarted:" + myApp.isAntiTheftServiceStarted);
	L.i("isBgdService2Started:" + myApp.isBgdService2Started);
	if (myApp.isAntiTheftServiceStarted || myApp.isBgdService2Started){
		MainActivity.this.finish();
	}else{
		Intent startMain = new Intent(Intent.ACTION_MAIN);
		startMain.addCategory(Intent.CATEGORY_HOME);
		startMain.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 
		startActivity(startMain);
		System.exit(0);
	}
	//确认是否在退出后取消接收聊天信息
	SettingSPUtil setSP = MyApp.getInstance().getSettingSPUtil();
	if (!setSP.isChatReceiveMsgAlways()){
		PushManager.stopWork(getApplicationContext());
	}
}
 
Example 2
Source File: CrashHandler.java    From QiQuYing with Apache License 2.0 6 votes vote down vote up
/** 
 * 自定义错误处理,收集错误信息 发送错误报告等操作均在此完成. 
 *  
 * @param ex 
 * @return true:如果处理了该异常信息;否则返回false. 
 */   
private boolean handleException(final Throwable ex) {   
    if (ex == null) {   
        return false;   
    }
    /*new Thread() {    
        @Override    
        public void run() {    
            Looper.prepare();   
            showDialog(mContext);  
            Looper.loop();   
        }    
    }.start();*/
    MobclickAgent.onKillProcess(mContext);
    //收集设备参数信息     
    collectDeviceInfo(mContext);
    //保存日志文件     
    saveCrashInfo2File(ex);   
    return true;   
}
 
Example 3
Source File: MainActivity.java    From ONE-Unofficial with Apache License 2.0 6 votes vote down vote up
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    if (keyCode == KeyEvent.KEYCODE_BACK) {
        //2秒之内的连续按返回键视为退出,防止误操作
        if (System.currentTimeMillis() - curTime < 2000) {
            finish();
            MobclickAgent.onKillProcess(this);
            System.exit(0);
        } else {
            TextToast.shortShow("再按一次退出");
            curTime = System.currentTimeMillis();
        }
        return true;
    }
    return super.onKeyDown(keyCode, event);
}
 
Example 4
Source File: UrlConfigActivity.java    From freeiot-android with MIT License 6 votes vote down vote up
@Override
public void onBackPressed() {
	if (UserState.getInstances(this).isLogin()) {
		if (lastUrlState != UrlConfigManager.getCurrentState()) {
			UserState.getInstances(this).logout(this);
			setResult(RESULT_OK);
			
			Intent mStartActivity = new Intent(this, SplashActivity.class);
			int mPendingIntentId = 123456;
			PendingIntent mPendingIntent = PendingIntent.getActivity(this, mPendingIntentId,    mStartActivity, PendingIntent.FLAG_CANCEL_CURRENT);
			AlarmManager mgr = (AlarmManager)getSystemService(Context.ALARM_SERVICE);
			mgr.set(AlarmManager.RTC, System.currentTimeMillis() + 200, mPendingIntent);
			MobclickAgent.onKillProcess(this);
			android.os.Process.killProcess(android.os.Process.myPid());
			return;
		}
	}
	ActivityUtils.animFinish(this, R.anim.slide_in_from_left, R.anim.slide_out_to_right);
}
 
Example 5
Source File: AppManager.java    From FriendBook with GNU General Public License v3.0 5 votes vote down vote up
public void exit() {
    try {
        finishAllActivity();
        // 友盟统计,统计关闭
        MobclickAgent.onKillProcess(mApplication);
        // 杀死该应用进程
        android.os.Process.killProcess(android.os.Process.myPid());
    } catch (Exception e) {
        Logger.e(e);
    }
}
 
Example 6
Source File: CrashHandler.java    From letv with Apache License 2.0 5 votes vote down vote up
public void uncaughtException(Thread thread, Throwable ex) {
    try {
        LogInfo.log("king", "uncaughtException");
        throw new Exception(ex);
    } catch (Exception e) {
        e.printStackTrace();
        if (handleException(ex) || this.mDefaultHandler == null) {
            try {
                Thread.sleep(3000);
            } catch (InterruptedException e2) {
                LogInfo.log(TAG, "Error : " + e2);
            }
            PreferencesManager.getInstance().setCrashCount(PreferencesManager.getInstance().getCrashCount() + 1);
            if (PreferencesManager.getInstance().getDownloadFlag() != 1) {
                ((NotificationManager) LetvApplication.getInstance().getSystemService("notification")).cancel(1000);
            }
            DownloadManager.pauseAllDownload();
            LetvCacheMannager.getInstance().destroy();
            if (LetvConfig.isUmeng()) {
                MobclickAgent.onKillProcess(LetvApplication.getInstance());
            }
            Process.killProcess(Process.myPid());
            System.exit(1);
            return;
        }
        this.mDefaultHandler.uncaughtException(thread, ex);
        PreferencesManager.getInstance().setCrashCount(PreferencesManager.getInstance().getCrashCount() + 1);
    }
}
 
Example 7
Source File: AppManager.java    From MarkdownEditors with Apache License 2.0 5 votes vote down vote up
/**
 * 退出应用程序
 *
 * @param context 上下文
 */
public void AppExit(Context context) {
    try {
        MobclickAgent.onKillProcess(BaseApplication.context());
        finishAllActivity();
        // 杀死该应用进程
        android.os.Process.killProcess(android.os.Process.myPid());
        System.exit(0);
    } catch (Exception e) {
        MobclickAgent.reportError(BaseApplication.context(), e);
    }
}
 
Example 8
Source File: MobclickAgentProxy.java    From android-project-wo2b with Apache License 2.0 5 votes vote down vote up
public static void onKillProcess(Context arg0)
{
	if (!DEBUG)
	{
		MobclickAgent.onKillProcess(arg0);
	}
}
 
Example 9
Source File: Main.java    From iSCAU-Android with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    if(keyCode == KeyEvent.KEYCODE_BACK && event.getAction() == KeyEvent.ACTION_DOWN){
        if((System.currentTimeMillis()-exitTime) > 2000){
            Toast.makeText(getApplicationContext(), "再按一次退出程序", Toast.LENGTH_SHORT).show();
            exitTime = System.currentTimeMillis();
        }
        else{
            MobclickAgent.onKillProcess(this);
            System.exit(0);
        }
        return true;
    }
    return super.onKeyDown(keyCode, event);
}
 
Example 10
Source File: UmengUtil.java    From UmengUtil with Apache License 2.0 4 votes vote down vote up
public static void onKillProcess(){
    MobclickAgent.onKillProcess(context);
}
 
Example 11
Source File: SimplifyReaderApplication.java    From SimplifyReader with Apache License 2.0 4 votes vote down vote up
public void exitApp() {
    BaseAppManager.getInstance().clear();
    System.gc();
    MobclickAgent.onKillProcess(this);
    android.os.Process.killProcess(android.os.Process.myPid());
}