Skip to main content
Version history: see Android SDK - Version history for the latest version and the changes in each release.

Installation


This process needs to be followed only once, the first time you need to install the SDK in your project. To update the SDK later, change the version in the dependency (see the version history). The SDK is distributed through a private Cloudsmith Maven repository.
1

Add your Cloudsmith credentials

In your local.properties, add the credentials provided by Kleep:
local.properties
Replace TOKEN_VALUE with the token provided by Kleep. The username is the literal string token.
2

Add the Cloudsmith Maven repository

In your settings.gradle or settings.gradle.kts, add the following lines:
3

Add the dependency

In your module’s build.gradle or build.gradle.kts file, add the following lines to create the dependency:
Replace version with the latest version from the version history, including the leading v: for example com.klipfit:kleep-android:v4.2.1.
These instructions apply to older SDK versions distributed through JitPack.
  1. In your gradle.properties, add this token: authToken=jp_9ibcequhrjtge3cmavt2k4sq6a
  2. In your settings.gradle or settings.gradle.kts, add the following lines:
  3. In your module’s build.gradle or build.gradle.kts file, add the following lines to create the dependency:

Initialization


Edit your custom Application class and provide applicationContext for initialization.
Don’t forget to add your Application class to AndroidManifest.xml

Import


You can manually import the module at the beginning of your MainActivity.kt

Usage


The SDK comes with 3 methods:

Retailer identifier

The value passed to setRetailer is the identifier (UUID) of your retailer account, given by your Kleep account manager. It is not the name of your company. Kleep creates one retailer account per environment, so you receive one identifier for your test catalogue and one for production. The identifier is the only thing that selects the environment: both use the same SDK and the same API. If the identifier is empty or unknown, every product is reported as not supported (KleepResult.NotSupported) and the CTA never shows.

Body scan

By default, the morphology screen offers two ways to get a size: answer the questionnaire, or scan the body with the phone camera. Call .setBodyScanEnabled(false) on the builder to offer the questionnaire only (Android SDK v4.2.2 or later):
  • the “scan” button is not shown, and no screen leads to the camera;
  • the SDK never requests the CAMERA permission at runtime.
The SDK manifest still declares android.permission.CAMERA for the apps that keep the scan, and the manifest merger adds it to your app. If you turn the scan off and don’t want the permission listed, remove it in your app manifest:
The camera is not a required feature (android.hardware.camera.any with required="false"), so the SDK doesn’t hide your app from devices without a camera. On such a device the scan button is not shown.

Size guide journeys

The size guide shows the questions of the product’s category. Kleep decides the journey from your catalogue and your account settings: there is nothing to pass. requestSize and show work the same way for every journey. A category not enabled for your account returns KleepResult.NotSupported.

Shopper profiles

From v4.2.3, the SDK keeps one profile per category and, for clothing, one per gender:
  • going from clothing to shoes and back keeps both profiles;
  • a men’s profile never gives a size on a women’s product, and the reverse: requestSize returns KleepResult.NoRecommendationYet until the shopper answers for that gender. The new form starts empty;
  • a unisex product, or one without gender, uses the last clothing profile.
Profiles are kept on the device across app launches. Profiles made with an older version are kept.

Similar products

When the recommended size is out of stock (see stocks in show), the result can offer similar products available in that size, so that your app opens its own product page with that size selected. The SDK never opens a web page: similar products are shown only when you set the listener below, and only the ones Kleep returns with their reference. To open your own product page instead, with the size already selected, pass a listener to setOnSimilarProductSelectedListener (v4.3.0 or later). When the shopper taps a similar product, the size guide closes first, then your listener runs on the main thread with a KleepSimilarProduct:
From Java, the listener is a functional interface:
The listener is optional, and only used by show(). Without it (null, or the method not called), the result shows no similar products. Before v4.3.0, a tap opened the product’s web page.

Method 1: requestSize

This method allows to implement the logic of the CTA. Logic schema This schema explains how to update the CTA opening Kleep. https://www.figma.com/board/BlurZ01lR3JBQZeTUU98TE/Mobile---CTA-Logic?node-id=0-1&t=ccXWciNziIdfhgew-1 Implementation example
The SDK currently supports 12 UI languages, passed via setLang:
  • fr — French (default)
  • en — English
  • en-US — US English
  • de — German
  • el — Greek
  • es — Spanish
  • it — Italian
  • ja — Japanese
  • ko — Korean
  • nl — Dutch
  • pt — Portuguese
  • ru — Russian
de, el, ja, ko, ru and en-US require SDK v4.2.0 or later.en-US shows the English texts with US units selected by default: height in ft/in, weight in lbs and US bra sizes. Shoppers can still switch units.These are language codes, not country codes: Greek is el (not GR), Japanese is ja (not JP) and Korean is ko (not KR).From v4.2.0, setLang accepts any case and a region suffix: "DE" and "de-AT" select German, and "en_US" selects US English.If a language you need isn’t in the list, contact your Kleep representative.

Method 2: show

This method is called when the CTA is clicked. It allows to load the different screens. The developper integrating the SDK should embed them into a bottom sheet.

Method 3: track

This method allows to track custom events.
Each event carries the retailer and the customer ID of the last requestSize or show. From v4.2.3 they are kept across app launches, so a purchase made after a relaunch, without any product page in between, still carries them. From v4.2.3, the SDK sends two events itself, you don’t need to add them: We want you to track 3 events: product_viewed Parameters Example
product_added_to_cart Parameters Example
checkout_completed Parameters Example

A/B testing


Requires Android SDK v4.2.3 or later. Kleep can run an A/B holdout test on your app to measure what it brings: part of your shoppers see the Kleep CTA (group test), the others don’t (group control). You start and stop the test from your Kleep dashboard, see A/B testing. You have no code to add:
  • Control group: requestSize returns KleepResult.NotSupported, so your app hides the CTA as it does for a product without size guide. show doesn’t open the size guide for a shopper known to be in this group.
  • Test group: nothing changes.
  • Same group on the web and in the apps: the group is computed from setCustomerId. Pass the same member ID as on your website, character for character. Without it, the SDK uses an anonymous ID of the device: a shopper can then be in one group in the app and in the other on the web.
  • If anything fails, Kleep is shown: no network, no answer in time, no test running.
  • When a change applies: the SDK reads the test status once per app session. After a start or a stop, each shopper gets the change at their next app launch, as soon as the status is refreshed (a product page opened in the first seconds of that launch may still use the previous one).

Log the group in your own analytics

Test both groups

Force the group for the current app session. It works only in a debuggable build, while a test is running:

Google Play Data safety

Google Play asks every app to declare, in its Data safety form, the data it collects, including the data collected by the SDKs it contains. Here is what the Kleep SDK collects, to fill in your form. The SDK sends this data to Kleep, to compute the size recommendation, measure the use of the size guide and, from v4.2.3, detect errors. It contains no third-party SDK (no analytics, advertising or crash-reporting library). From v4.2.3, while an A/B test runs for your account, the SDK also calls PostHog (EU), Kleep’s A/B testing processor, with the customer identifier (or an anonymous ID), the group and the product viewed. It sends nothing to PostHog when no test runs. All this data is encrypted in transit (HTTPS). Shoppers can ask for their data to be deleted by writing to dpo@kleep.ai. For any other question about personal data, see the data processing agreement of your contract or write to dpo@kleep.ai.