로딩중입니다
[AOS] 使用 ProcessKill 时,endSession 集成
8/17/2015 12:16:59 PM

使用 ProcessKill 时,endSession 的处理方法

使用 ProcessKill 等强制处理终止 Android 应用时,会出现遗失 adbrix 跟踪数据的情况

Adbrix 的跟踪数据在调用 IgawCommon.endSession() API 时,通过服务器传送,在指南中说明是在 onPause() 中调用 API


点击 Android 返回按钮,曝光终止弹窗并点击终止时,在使用 ProcessKill 等强制终止的方式下时常出现无法正常调用 endSession API 的情况


Android 返回按钮的 Event Action 请如下进行处理,建议让 endSession API 正常进行调用。

public boolean onKeyDown(int keyCode, KeyEvent event){
	switch(keyCode){
	case KeyEvent.KEYCODE_BACK:

		IgawCommon.protectSessionTracking(this);

		new AlertDialog.Builder(this)
		.setTitle("终止确认")
		.setMessage("确定要终止吗?")
		.setPositiveButton("是", new DialogInterface.OnClickListener(){
    			public void onClick(DialogInterface dialog, int which){

				// 强制终止该应用的进程
				android.os.Process.killProcess(android.os.Process.myPid());
 			}
    		}).setNegativeButton("否", new DialogInterface.OnClickListener(){
    			public void onClick(DialogInterface dialog, int which){
			}
    		}).show();
	}
   	return true;
}