SDK Customization

SDK Customization

The PageSense Android Full Stack SDK provides customization options that allow you to control how the SDK behaves inside your application. These options help you balance freshness of experiment configuration, logging verbosity, and operational stability.

SDK customization is optional. If you do not configure any options, the SDK runs with sensible defaults.

What can be customized  

Using SDK customization, you can configure:

  • Polling interval for refreshing project settings

  • Custom logger for handling SDK logs

  • Log level control through your logging implementation

All customizations are applied during SDK initialization using PageSenseSDKOptions.

Polling configuration  

The SDK uses polling to refresh Full Stack project settings. You can configure how frequently polling occurs.

Polling rules  

  • Default polling interval: 5 minutes

  • Polling interval must be 5 minutes or higher

  • Any value below 5 minutes is not permitted

  • If a value lower than 5 minutes is provided, it is automatically normalised to 15 minutes

Polling is triggered only when the app is active and follows the lifecycle rules described in the Project Settings documentation.

Setting polling interval  

Polling interval is specified in minutes.

JAVA Example  

  1. PageSenseSDKOptions pageSenseSDKOptions = new PageSenseSDKOptions();
  2. pageSenseSDKOptions.setPollingInterval(10); // in minutes

KOTLIN Example  

  1. val pageSenseSDKOptions = PageSenseSDKOptions()
  2. pageSenseSDKOptions.pollingInterval = 10 // in minutes

Custom logging  

By default, the SDK logs messages using its internal logger.
If your application uses a centralized logging framework, you can plug in a custom logger to capture and manage SDK logs yourself.

When a custom logger is configured:

  • All SDK logs are routed through your logger

  • You control where and how logs are stored or displayed

Creating a custom logger  

Your custom logger must implement the PageSenseLogger interface and handle log messages at different severity levels.

JAVA Example  

  1. PageSenseLogger pageSenseLogger = new PageSenseLogger() {
  2.  
  3.     @Override
  4.     public void severe(@Nullable String logMessage) {
  5.     }
  6.  
  7.     @Override
  8.     public void error(@Nullable String logMessage) {
  9.     }
  10.  
  11.     @Override
  12.     public void warn(@Nullable String logMessage) {
  13.     }
  14.  
  15.     @Override
  16.     public void info(@Nullable String logMessage) {
  17.     }
  18.  
  19.     @Override
  20.     public void debug(@Nullable String logMessage) {
  21.     }
  22.  
  23.     @Override
  24.     public void trace(@Nullable String logMessage) {
  25.     }
  26. };

KOTLIN Example  

  1. val pageSenseLogger = object : PageSenseLogger() {
  2.  
  3.     override fun severe(logMessage: String?) {
  4.     }
  5.  
  6.     override fun error(logMessage: String?) {
  7.     }
  8.  
  9.     override fun warn(logMessage: String?) {
  10.     }
  11.  
  12.     override fun info(logMessage: String?) {
  13.     }
  14.  
  15.     override fun debug(logMessage: String?) {
  16.     }
  17.  
  18.     override fun trace(logMessage: String?) {
  19.     }
  20. }

Applying SDK options during initialization  

Once polling and logging options are configured, pass the PageSenseSDKOptions object while initializing the SDK.

JAVA Example  

  1. PageSenseSDKOptions pageSenseSDKOptions = new PageSenseSDKOptions();
  2. pageSenseSDKOptions.setPollingInterval(10); // in minutes
  3. pageSenseSDKOptions.setCustomLogger(pageSenseLogger);
  4.  
  5. PageSenseClientBuilder.createNewPageSenseClient(
  6.     "sdkAccountId",
  7.     "sdkKey",
  8.     "projectName",
  9.     pageSenseSDKOptions,
  10.     new ProjectSettingsCallBack() {
  11.  
  12.         @Override
  13.         public void onFailure(@NotNull String message, @Nullable Integer code) {
  14.         }
  15.  
  16.         @Override
  17.         public void onSuccess(PageSenseClient client) {
  18.             // PageSenseClient is initialized with custom options
  19.             pageSenseClient = client;
  20.         }
  21.     }
  22. );

 

KOTLIN Example  

  1. val pageSenseSDKOptions = PageSenseSDKOptions()
  2. pageSenseSDKOptions.pollingInterval = 10 // in minutes
  3. pageSenseSDKOptions.customLogger = pageSenseLogger
  4.  
  5. PageSenseClientBuilder.createNewPageSenseClient(
  6.     "sdkAccountId",
  7.     "sdkKey",
  8.     "projectName",
  9.     pageSenseSDKOptions,
  10.     object : ProjectSettingsCallBack {
  11.  
  12.         override fun onFailure(message: String, code: Int?) {
  13.         }
  14.  
  15.         override fun onSuccess(client: PageSenseClient?) {
  16.             // PageSenseClient is initialized with custom options
  17.             pageSenseClient = client
  18.         }
  19.     }
  20. )

Log levels  

The SDK supports multiple log severity levels, including:

  • TRACE

  • DEBUG

  • INFO

  • WARN

  • ERROR

  • SEVERE

When using a custom logger, log level handling is fully controlled by your implementation.
This allows you to:

  • Suppress verbose logs in production

  • Enable detailed logs during development

  • Integrate with existing logging pipelines

Best practices  

  • Use the default polling interval unless you have a clear need to change it

  • Avoid aggressive polling to reduce network and battery usage

  • Use a custom logger in production environments

  • Keep verbose logging (DEBUG / TRACE) limited to development builds

What happens if customization is not used  

If no SDK options are provided:

  • Default polling behavior is applied

  • Internal SDK logging is used

  • The SDK operates safely with standard defaults