Sessions
Overview
Android application is a set of Activities and the relationship between application and activities is loose. But in case of Unity, Activities is created by Unity framework therefore only One Activity is created by Android. Still base is android and therefore 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.
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 sessionIn 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.
1. End with BACK key
2. Exit by code
3. Switch to background
4. Killed by system task manager
5. Killed by system
Session Integration Steps- User starts application, session begins
- Main activity is created
- User presses BACK key
- Main activity is destroyed
- Session ends
2. Exit by code
- User starts application, session begins
- Main activity is created
- User click on 'quit' button of main activity
- Main activity is destroyed
- Session ends
3. Switch to background
- User starts application, session begins
- Main activity is created
- User presses HOME key to go to home screen
- User click application icon after 45 seconds
- Application is brought to front, session is closed, new session begins
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
- User starts application, session begins
- User presses the HOME key to open system task manager
- User kills application with system task manager. Session ends
5. Killed by system
- User starts application, Session starts
- User switches to another application
- Application is running in background; application gets killed by system for low memory. Session ends
In Unity, sessions are not linked to the application Life Cycle and so the session functions need to be executed from unity lifecycle functions.
The AdGyde lifecycle functions which record the sessions need to be liked directly to functions in Unity Lifecycle. Below is the example code where this direct linking is shown
The AdGyde lifecycle functions which record the sessions need to be liked directly to functions in Unity Lifecycle. Below is the example code where this direct linking is shown
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class Sample_UI_Class : MonoBehaviour { private static Sample_UI_Class _instance = null;} |