AdGyde Logo

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
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
1. End with Home key
  1. User starts application, session begins
  2. Main activity is created
  3. User presses Home 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 Notification and moves to another application
  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 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:
  1. Adgyde.ag_ApplicationDidEnterBackground(application)
  2. Adgyde.ag_ApplicationDidBecomeActive(application)


    1. import Firebase
      import Adgyde_SDK

      @UIApplicationMain
      class AppDelegate: UIResponder, UIApplicationDelegate {
      func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
      // Override point for customization after application launch.
      return true
      }

      func applicationDidEnterBackground(_ application: UIApplication) {
      Adgyde.ag_ApplicationDidEnterBackground(application)
      }

      func applicationDidBecomeActive(_ application: UIApplication) {
      Adgyde.ag_ApplicationDidBecomeActive(application)
      }
      }
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.