AdGyde Logo

Sessions


Overview
Android application is a set of Activities and the relationship between application and activities is loose. One of the most common case issues is that the application won't quit after the BACK key is pressed this makes the developers & user confused. AdGyde redefined session to makes it easy to understand.

Definition of session
A session is a conversation between mobile application and user. A session starts with application start and it ends after the user has quit the application. In user’s perspective, pressing BACK key on main activity or click on quit button on the application will initiate application quit, but instead these tasks switch the application to background which is quite hard to understand.

Normally developer use finish() to quit application by code.
public class MainActivity extends Activity {
protected onCreate(Context context) {
// some code
Button quitButton = (Button)findViewById(R.id.quitAppButton);
quitButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// quit application by close main activity
MainActivity.this.finish();
}
});
}
}

MainActivity.this.finish() will close the main activity but won't quit the application, this just puts the application to background. In understanding the MainActivity should be created when user starts the application again, but as application is already in background it just switches background to foreground.

AdGyde redefines quitting of the application - As soon as the user closes the last activity the session is closed. It is exactly in accordance with the user experience with the application. Pressing BACK key on last activity will be considered as the user wants to quit the application.

Scenarios of session
1. End with BACK key
  1. User starts application, session begins
  2. Main activity is created
  3. User presses BACK key
  4. Main activity is destroyed
  5. Session ends
2. Exit by code
  1. User starts application, session begins
  2. Main activity is created
  3. User click on 'quit' button of main activity
  4. Main activity is destroyed
  5. Session ends
3. Switch to background
  1. User starts application, session begins
  2. Main activity is created
  3. User presses HOME key to go to home screen
  4. User click application icon after 45 seconds
  5. Application is brought to front, session is closed, new session begins

  6. Session will be closed if the application was switched to background for more than 30 seconds, as it is assumed that the user switched to another task / application and the application in context is not in use.
4. Killed by system task manager
  1. User starts application, session begins
  2. User presses the HOME key to open system task manager
  3. User kills application with system task manager. Session ends
5. Killed by system
  1. User starts application, Session starts
  2. User switches to another application
  3. Application is running in background; application gets killed by system for low memory. Session ends

Session Integration Steps
In AdGyde Android SDK, sessions are linked to the android application Life Cycle and so are calculated automatically without any integration.


This website uses cookies in order to improve your experience and our services. By continuing to use our website, agree to the use of such cookies. Click here for Privacy Policy.