로딩중입니다
How to process endSession for ProcessKill
6/5/2015 4:35:29 PM

How To Process endSession for ProcessKill


If the Android app is forced to closeProcessKill, etc., Adbrix tracking data may be lost.

Although the Adbrix tracking data is transmitted to the server when the IgawCommon.endSession() API is called up, the guide instructs the API to be called from onPause().

When a forced closure occurs such as from ProcessKill,  oftentimes the endSession API isn't called up even after touching the Back button in the Android or pressing the Close button in the popup. 

Regarding the event action for the Back button in the Android, refer to the following to call up the endSession api properly.

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

                // Call IgawCommon.endSession 
		IgawCommon.endSession()

		new AlertDialog.Builder(this)
		.setTitle("Verify Closure")
		.setMessage("Do you want to quit now?")
		.setPositiveButton("Yes", new DialogInterface.OnClickListener(){
    			public void onClick(DialogInterface dialog, int which){

				// Kill the process of the corresponding application. 
				android.os.Process.killProcess(android.os.Process.myPid());
 			}
    		}).setNegativeButton("No", new DialogInterface.OnClickListener(){
    			public void onClick(DialogInterface dialog, int which){
				IgawCommon.startSession();
			}
    		}).show();
	}
   	return true;
}