Sessions
Overview
iOS architecture is a layered architecture. At the top level, iOS acts as an intermediary between the underlying hardware and applications are made. However, applications do not communicate directly with the underlying hardware. Similarly, applications talk to the hardware through a collection of well-defined interfaces systems.
These interfaces make it easy to write applications that work consistently on devices that have different hardware capabilities.
Lower layers provide basic services to all applications. Likewise, it is based on the upper layer level and gives a sophisticated graphics interface and related services.
Apple provides most of its system interfaces in special packages called frames. A frame is a directory that contains a dynamic shared library that is filed, such as header files related images and helper applications needed to support that library resources. Thus, each layer has a set of the framework that the developer uses to build applications. Here is the layered architecture of the iOS platform.
Definition of session These interfaces make it easy to write applications that work consistently on devices that have different hardware capabilities.
Lower layers provide basic services to all applications. Likewise, it is based on the upper layer level and gives a sophisticated graphics interface and related services.
Apple provides most of its system interfaces in special packages called frames. A frame is a directory that contains a dynamic shared library that is filed, such as header files related images and helper applications needed to support that library resources. Thus, each layer has a set of the framework that the developer uses to build applications. Here is the layered architecture of the iOS platform.
A session is a conversation between mobile application and user. A session starts with application start and it ends after the user moves to another application or moves application to background. In user’s perspective, pressing the Home key will initiate application quit, but instead these tasks switch the application to background which is quite hard to understand.
In understanding the Main Page of the application 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 application the session is paused and timer started. If application doesn't come to foreground in 30 seconds then session is considered closed, else it continues from previous sessions.
Scenarios of session In understanding the Main Page of the application 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 application the session is paused and timer started. If application doesn't come to foreground in 30 seconds then session is considered closed, else it continues from previous sessions.
1. End with Home 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 Home key
- Main activity is destroyed
- Session ends
- User starts application, session begins
- Main activity is created
- User click on 'quit' button of main activity
- Main activity is destroyed
- Session ends
- User starts application, session begins
- Main activity is created
- User presses Notification and moves to another application
- 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.
- User starts application, session begins
- User presses the HOME key to open system task manager
- User kills application with system task manager. Session ends
- 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 iOS, sessions are linked to the application Life Cycle and so the session functions need to be executed on Session Application start and Appliction end triggers
The AdGyde lifecycle functions which record the sessions need to be liked directly to functions in iOS Lifecycle. Below is the example code where this direct linking is shown. For Session Tracking need to write these two methods in appdelegate:
The AdGyde lifecycle functions which record the sessions need to be liked directly to functions in iOS Lifecycle. Below is the example code where this direct linking is shown. For Session Tracking need to write these two methods in appdelegate:
- Adgyde.ag_ApplicationDidEnterBackground(application)
- Adgyde.ag_ApplicationDidBecomeActive(application)
import Firebase import Adgyde_SDK @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {}} |