Skip to main content

Android Native SDK

The PulpoAR Android SDK brings Skin Analysis into your Android app natively, with no WebView. It shows your project's questionnaire, a guided selfie and the result with the skin health score and your recommended products, styled with your Studio theme. Photos are analyzed on the device and never uploaded.

Pre-release

The Android SkinAI SDK is in preview. Pin an exact version and test your release build on a device before shipping.

Before you start
  • The SDK is proprietary and needs an agreement with PulpoAR.
  • You need your project key (the project's slug) from PulpoAR Studio. The SDK uses it to load your questionnaire, products and theme.

Choose an artifact​

ArtifactUse it when
com.pulpoar:skinai-ui (recommended)You want the complete skin analysis (questionnaire, guided selfie, result, recommended products and routines), styled with your Studio theme. One activity or composable. Includes the Kit and the engine.
com.pulpoar:skinai-kitYou design your own screens. The Kit analyzes a photo on the device (skin health score, 12 concern scores, visuals), checks a live camera frame, and loads your project's questions and recommendations.

Requirements​

  • Android 7.0 (API 24) or later (minSdk = 24)
  • Built and tested with compileSdk 36, AGP 8.13 and Java 17
  • For the PulpoSkinAIView composable: Jetpack Compose with the Kotlin Compose compiler plugin (org.jetbrains.kotlin.plugin.compose). PulpoSkinAIActivity needs no Compose setup.

1. Add the PulpoAR repository​

In settings.gradle.kts:

dependencyResolutionManagement {
repositories {
google()
mavenCentral()
maven {
url = uri("https://assets.pulpoar.com/vision/pulpo-sdk/android/maven")
content { includeGroup("com.pulpoar") }
}
}
}

2. Add the dependency​

In your app module's build.gradle.kts:

dependencies {
implementation("com.pulpoar:skinai-ui:<version>")
}

Always pin an exact version. The repository has no "latest" index. SkinAI has its own version line: find the newest skinai- version on the releases page.

3. Camera permission​

Nothing to add. The SDK merges the INTERNET, ACCESS_NETWORK_STATE and CAMERA permissions into your manifest, and the UI asks for the camera when it needs it.

4. Configure once​

In your Application class:

import com.pulpoar.skinai.kit.PulpoSkinAIAnalyticsConsent
import com.pulpoar.skinai.kit.PulpoSkinAIConfiguration
import com.pulpoar.skinai.kit.PulpoSkinAIKit

class MyApplication : Application() {
override fun onCreate() {
super.onCreate()
PulpoSkinAIKit.configure(this, PulpoSkinAIConfiguration(PulpoSkinAIAnalyticsConsent.PENDING))
}
}

Nothing is reported while consent is PENDING. When the user answers your consent prompt, pass their answer:

PulpoSkinAIKit.analyticsConsent =
if (userAccepted) PulpoSkinAIAnalyticsConsent.GRANTED else PulpoSkinAIAnalyticsConsent.DENIED
warning

Never pass GRANTED without the user's consent.

5. Show the skin analysis​

Full screen activity​

startActivity(PulpoSkinAIActivity.intent(context, "your-project"))

It finishes on its close button. Set PulpoSkinAIActivity.callbacks before starting it to receive events, product taps and errors (don't hold an Activity in them).

Compose​

PulpoSkinAIView(
projectKey = "your-project",
modifier = Modifier.fillMaxSize(),
configuration = PulpoSkinAIUIConfiguration(
onClose = { navController.popBackStack() },
onEvent = { event -> if (event is PulpoSkinAIEvent.AddToCart) cart.add(event.products) },
),
)

6. Connect it to your app​

All options are optional:

OptionDescription
onProductTapCalled when a recommended product's button is tapped. Without it, the product's web page opens.
onCloseCalled when the close button is tapped. Dismiss the view here. Without it, there's no close button.
onEventCalled for each step of the flow, with the same events as the JavaScript SDK (event.key is the web event's name, such as onAddToCart). The UI has no cart: add the products on PulpoSkinAIEvent.AddToCart. Called whatever the analytics consent.
onErrorCalled when loading the project, starting the camera or analyzing a photo fails. The UI shows the error itself.
localeForces a language: en, tr, pt, it, fr or ru. Otherwise it follows the device.

The products tab's add-all button is off by default. Turn it on in your Studio theme (result.withAddToCartAllProducts).

Building your own UI with the Kit​

Add com.pulpoar:skinai-kit instead of skinai-ui, and configure it as in step 4:

val project = PulpoSkinAIProject.load("your-project")
val analyzer = PulpoSkinAnalyzer() // keep one while the feature is on screen, then close() it
val analysis = analyzer.analyze(photo) // a Bitmap; a few seconds, on the device
println("${analysis.skinHealthScore} ${analysis.scores[PulpoSkinIssue.ACNE]}")

analyzer.checkFace(frame) checks a live camera frame (face direction, position, distance and light) to guide the user before the photo.

Resources​