Installation of Android SDK

Installation of Android SDK

The PageSense Android Full Stack SDK lets you run server-side A/B tests and track experiment outcomes directly from your Android application. Once installed, your app can participate in Full Stack experiments and start collecting core analytics data.

This section walks you through installing and setting up the SDK in an Android project.

What this allows you to do  

After completing this setup, you will be able to:

  • Connect your Android app to PageSense

  • Participate in Full Stack A/B experiments

  • Start collecting basic app metrics such as users and sessions

  • Prepare your app for experiment activation and goal tracking

Requirements  

Before you begin, make sure that:

  • You have an Android application set up with Gradle

  • You have access to a PageSense account

  • A mobile app is registered in PageSense and an App ID is generated


Step 1: Add the PageSense Maven Repository  

To download the PageSense SDK, you need to add the PageSense Maven repository to your project.
Depending on your project configuration, do one of the following.

If your project uses settings.gradle  

Add the PageSense repository inside the repositories block:

  1. dependencyResolutionManagement {
  2.     repositories {
  3.         google()
  4.         mavenCentral()
  5.         maven {
  6.             url'https://maven.zohodl.com'        

  7. }
  8.     }
  9. }

If your project uses project-level build.gradle  

Add the following block below the existing configuration in your root build.gradle file:

  1. allprojects {
  2.     repositories {
  3.         maven {
  4.             url 'https://maven.zohodl.com'
  5.         }
  6.     }
  7. }


Step 2: Add the SDK Dependency  

Open the app-level build.gradle file and add the PageSense SDK dependency:

dependencies {
  implementation 'com.zoho.pagesense:pagesense:1.1.0'
}

Step 3: Initialize the SDK  

To ensure the SDK starts tracking as soon as your app launches, initialize PageSense in the onCreate method of your Application class.


KOTLIN
  1. class MyApplication : Application() {
  2.     override fun onCreate() {
  3.         super.onCreate()
  4.         PageSense.init(this, appId)    }
  5. }


JAVA
  1. public class MyApplication extends Application {
  2.     @Override
  3.     public void onCreate() {
  4.         super.onCreate();
  5.        PageSense.init(this, appId)    }
  6. }

Notes
Note: Initializing the SDK inside the Application class ensures it runs once per app lifecycle.


Step 4: Register the Application Class  

Register your custom Application class in the AndroidManifest.xml file:

  1. <application
  2.     android:name=".MyApplication"
  3. ... >


NotesNote: This step is required for the SDK initialization code to run.

What happens after installation  

Once the SDK is installed and initialized:

  • Your app begins collecting basic analytics data such as users and sessions

  • The app is ready to take part in Full Stack experiments

  • You can proceed to activate experiments and track goals