Initialization of Android Full Stack SDK

Initialization of Android Full Stack SDK

After installing the PageSense Android Full Stack SDK, the next step is to initialize it with your project configuration. Initialization connects your app to PageSense and loads the Full Stack project settings required to run experiments.

In Android, this initialization is performed asynchronously. Once initialization is complete, you will receive a PageSenseClient instance that is used for all experiment-related operations.

What this allows you to do  

After successful initialization:

  • Your app fetches the latest Full Stack project settings from PageSense

  • Experiments, variations, and audience rules become available

  • The SDK is ready to activate experiments and track goals

  • Your app stays aligned with the configuration defined in PageSense

Details required for initialization  

To initialize the SDK, you need the following details from your PageSense account:

  • Account ID – Your PageSense account identifier (including the hosted region)

  • SDK Key – The SDK key generated for the selected environment

  • Project Name – The name of the project in PageSense

These values are available in the Environment settings of your Full Stack project.

Initializing the SDK  

Use the PageSenseClientBuilder to create and initialize the SDK client. The initialization process retrieves project settings from PageSense and returns the initialized PageSenseClient through a callback.


JAVA

  1. import com.zoho.pagesense.android.abtesting.PageSenseClient;
  2. import com.zoho.pagesense.android.abtesting.PageSenseClientBuilder;
  3. import com.zoho.pagesense.android.network.ProjectSettingsCallBack;PageSenseClientBuilder.createNewPageSenseClient(
  4. sdkAccountIdForDC,
  5. sdkKey,
  6. projectName,
  7. new ProjectSettingsCallBack() {
  8. @Override
  9. public void onFailure(@NotNull String message, @Nullable Integer code)
  10. {
  11. // TODO: Handle failure (log the error, retry, etc.)
  12. }
  13. @Override
  14. public void onSuccess(PageSenseClient client) {
  15. // You will get the initialised PageSenseClient here
  16. pageSenseClient = client;
  17. }
  18. }
  19. );
KOTLIN
  1. import com.zoho.pagesense.android.abtesting.PageSenseClient
  2. import com.zoho.pagesense.android.abtesting.PageSenseClientBuilder
  3. import com.zoho.pagesense.android.network.ProjectSettingsCallBack
  4. PageSenseClientBuilder.createNewPageSenseClient(
  5. sdkAccountIdForDC,
  6. sdkKey,
  7. projectName,
  8. object : ProjectSettingsCallBack {
  9. override fun onFailure(message: String, code: Int?) {
  10. // TODO: Handle failure (log the error, retry, etc.)
  11. }
  12. override fun onSuccess(client: PageSenseClient) {
  13. // You will get the initialised PageSenseClient here
  14. pageSenseClient = client
  15. }
  16. }
  17. )

What happens after initialization  

Once the SDK is initialized:

  • The PageSenseClient can be used to activate experiments

  • Users can be evaluated and assigned variations

  • Goal conversions can be tracked

  • SDK behavior can be customized if required