Skip to product menu
Skip to main content

Sessions in Android apps

A session is a single period of user interaction with your app. For example, when a user opens the app for the first time and when the app goes to the background, that is considered as a session.

Session tracking is a part of the analytics SDK which is used to measure active devices and the average time a user uses the app.

Add the SDK to your app

  • Before your begin, make sure that Apptics is integrated into your project by following the Integration Guide.
  • Declaring analytics dependency using Apptics BoM.
Copieddependencies {
  // ...

  // Apptics BoM, latest version is mentioned in the integration guide.
  implementation platform('com.zoho.apptics:apptics-bom:[latest-version]')
  
  // Since BoM version is specified, no need to explicitly specify the dependency version.
  implementation 'com.zoho.apptics:apptics-analytics'

}
  • If you do not use Apptics BoM you can directly declare the analytics dependency with its version.
Copieddependencies {
   // Have to explicitly mention the version, if you are not using BoM.
   // latest version is mentioned in the integration guide.
  implementation 'com.zoho.apptics:apptics-analytics:[latest-version]'
}

Note: It is recommend to use Apptics BoM to avoid unnecessary compatibility issues.

  • Initialize analytics in Application onCreate() method.
CopiedApptics.init(this)

Automatic session tracking

App session is tracked automatically on initializing the AppticsAnalytics class.

You can opt-out from automatically tracking the sessions by setting the automaticSessionTrackingStatus in the init method.

Make sure to disable automaticSessionsTracking before initializing Apptics.

CopiedAppticsAnalytics.automaticSessionsTrackingStatus = false
AppticsAnalytics.init(this)