Skip to content

Latest commit

 

History

History
257 lines (180 loc) · 7.5 KB

File metadata and controls

257 lines (180 loc) · 7.5 KB

CustomerPulse Android SDK

Easily integrate CustomerPulse surveys into your Android applications
Explore the API docs »

Report Bug · Request Feature

Platform Android API 21+ Language Java License MIT


Overview

CustomerPulse Android SDK provides a simple and elegant way to display customer satisfaction surveys in your Android applications. With just a few lines of code, you can gather valuable feedback from your users.

Features

  • Simple Integration - Get started with just a few lines of code
  • Secure - All communications over HTTPS
  • Multi-language Support - Built-in support for English and Arabic
  • Native Experience - Surveys displayed in WebView or Bottom Sheet
  • Configurable - Environment switching, dismissal control, auto-close timing
  • Debug Mode - Built-in logging for development

Table of Contents


Requirements

Requirement Minimum Version
Android API 21+
Java 8+

Installation

Option 1: AAR File (Recommended)

  1. Download CustomerPulseSurvey.aar from the Releases page
  2. Add it to your libs folder
  3. Add as JAR/AAR dependency in Project Structure

For detailed steps with screenshots, see docs/INSTALLATION.md.

Option 2: Gradle (Coming Soon)

implementation 'ae.gov.customerpulse:customerpulsesurvey:1.0.0'

Quick Start

1. Import the SDK

import com.customerpulse.customerpulsesurvey.CustomerPulseSurvey;

2. Show Survey

HashMap<String, String> options = new HashMap<>();
options.put("lang", "en");

CustomerPulseSurvey.showSurveyPage(this, "APP_ID", "TOKEN", options);

That's it!


Configuration

Environment

Switch between production and sandbox environments:

// Production (default)
CustomerPulseSurvey.setEnvironment(CustomerPulseSurvey.Environment.PRODUCTION);

// Sandbox (for testing)
CustomerPulseSurvey.setEnvironment(CustomerPulseSurvey.Environment.SANDBOX);

Set the environment before calling any survey display methods.

Debug Logging

Enable console logging during development:

CustomerPulseSurvey.setDebugLogging(true);

Output:

[CustomerPulse] Debug logging enabled
[CustomerPulse] Environment set to: SANDBOX
[CustomerPulse] Loading survey page
[CustomerPulse] URL: https://sandboxsurvey.customerpulse.gov.ae/TOKEN?lang=en&app_id=APP_ID
[CustomerPulse] Dismissible: true
[CustomerPulse] Closing delay: 2000ms

Note: Disable debug logging in production builds.


API Reference

Static Methods

Method Description
setEnvironment(Environment env) Set SDK environment (PRODUCTION/SANDBOX)
getEnvironment() Get current environment
setDebugLogging(boolean enabled) Enable/disable debug logging
isDebugLoggingEnabled() Check if debug logging is enabled

Survey Display Methods

Full Page Survey

CustomerPulseSurvey.showSurveyPage(context, app_id, token, options);
CustomerPulseSurvey.showSurveyPage(context, app_id, token, options, dismissible);
CustomerPulseSurvey.showSurveyPage(context, app_id, token, options, closingDelayMs);
CustomerPulseSurvey.showSurveyPage(context, app_id, token, options, dismissible, closingDelayMs);

Bottom Sheet Survey

CustomerPulseSurvey.showSurveyBottomSheet(context, app_id, token, options);
CustomerPulseSurvey.showSurveyBottomSheet(context, app_id, token, options, dismissible);
CustomerPulseSurvey.showSurveyBottomSheet(context, app_id, token, options, closingDelayMs);
CustomerPulseSurvey.showSurveyBottomSheet(context, app_id, token, options, dismissible, closingDelayMs);

With dismissible enabled (close button visible):

Parameters

Parameter Type Description Default
context Context Activity context (required). Do not use Application context. Required
app_id String Application ID provided by CustomerPulse Required
link_or_token String Token or linking ID provided by CustomerPulse Required
options HashMap<String, String> Additional parameters (e.g., language) Required
dismissible boolean Allow user to dismiss the survey true
closingDelayMs int Auto-close delay after completion (ms) 2000

Language Support

Set the survey language using the lang option:

HashMap<String, String> options = new HashMap<>();

// English
options.put("lang", "en");

// Arabic
options.put("lang", "ar");

Important: Context Requirement

The context parameter must be an Activity context, not an Application context.

// Correct - using Activity context
CustomerPulseSurvey.showSurveyPage(this, app_id, token, options);

// Correct - from a Fragment
CustomerPulseSurvey.showSurveyPage(getActivity(), app_id, token, options);

// INCORRECT - do not use Application context
CustomerPulseSurvey.showSurveyPage(getApplicationContext(), ...); // Will not work properly

The SDK requires an Activity context to:

  • Launch the survey Activity (for full-page surveys)
  • Display the BottomSheetDialog (for bottom sheet surveys)
  • Properly close the survey when completed

Example Project

Check out the example project in the app/ directory for a complete implementation.

# Open in Android Studio
File -> Open -> Select CustomerPulse-Android folder

Changelog

See CHANGELOG.md for a list of changes in each version.


Support


Made with care by CustomerPulse