Skip to main content

Android Framework API References

Initialization Method​

GlamAr.init(
context: Context,
accessKey: String,
overrides: GlamAROverrides? = null,
webView: WebView? = null,
debug: Boolean = false
)

Parameter Descriptions​

ParameterTypeRequiredDescription
contextContextYesThe Android context, typically passed from an Activity or Fragment. Used for WebView creation and permission handling.
accessKeyStringYesYour unique Access key to authenticate the SDK usage.
overridesGlamAROverrides?NoConfiguration object to control AR behavior, UI, and metadata. See GlamAROverrides for details.
webViewWebView?NoIf provided, the SDK will use this WebView instance instead of creating a new one. Allows full control over rendering. Defaults to null.
debugBooleanNoEnables detailed logging from the SDK. Useful for development/debugging. Defaults to false.

GlamAROverrides allows developers to customize the behavior, appearance, and initialization of the GlamAR SDK when integrating it into an Android app.

You can pass this configuration object directly into the SDK initialization:

GlamAr.initialize(
context = this,
accessKey = "your-access-key",
overrides = GlamAROverrides(...) // ← Custom behavior here
)

GlamAROverrides Structure​

category: String?​

Category has to be sent as skinanalysis. (Required)

configuration: Configuration?​

Contains the Skin analysis configuration

val overrides = GlamAROverrides(
configuration = Configuration(
skinAnalysis = SkinAnalysisConfig(
appId = "your_skin-app-id"
)
)
)

meta: Map<String, Any?>?​

Contains initialization metadata. Use preloadMLModels to download ML models during SDK initialization. Skin Analysis supports face and light.

Full Example​

val overrides = GlamAROverrides(
category = "skinanalysis",
configuration = Configuration(
skinAnalysis = SkinAnalysisConfig(
appId = "your_skin-app-id"
)
),
meta = mapOf(
"preloadMLModels" to listOf("face", "light")
)
)

Post-Initialization Methods​

open​

GlamAr.skinAnalysis("start");

Opens the Skin Analysis flow.
Return Value: None

ParametersDescriptionTypeOptions
optionsPass start (Required)stringstart

addEventListener​

GlamAr.addEventListener(eventName, handlerFunction);

Adds the listener to the given event name.
Return Value: None

ParametersTypeDescription
eventNamestring

A Name of specific event or "*" To listen to the all the events.

handlerFunctionfunction Your handler function that will listen to callback.

removeEventListener​

GlamAr.removeEventListener(eventName, handlerFunction);

Removes the given listener for the event name.
Return Value: None

ParametersTypeDescription
eventNamestring

A Name of specific event or "*" To remove all the events.

handlerFunctionfunction Your handler function that will listen to callback.

isLoaded​

GlamAr.isLoaded();

Returns the status of module loading.
Return Value: true if loaded, otherwise false

ParametersDescription

None

No parameters required.

setExperience​

GlamAr.setExperience(experience, options)

Switches the active SDK experience without reloading the full SDK. Use this to move between AR Try-On and Skin Analysis faster after the GlamAR module is already loaded.
Return Value: None

import io.pixelbin.glamar.model.VtoExperienceOptions
import io.pixelbin.glamar.model.SkinAnalysisExperienceOptions

GlamAr.setExperience("vto", VtoExperienceOptions(category = "eyewear"))
GlamAr.setExperience("vto", VtoExperienceOptions(subCategory = "lipstick"))
GlamAr.setExperience("vto", VtoExperienceOptions(skuId = "Your sku id"))

GlamAr.setExperience(
"skinAnalysis",
SkinAnalysisExperienceOptions(appId = "0732f85d-5768-462e-a50a-174840438a69")
)
ParametersTypeRequiredDescription
experienceStringYesExperience to switch to. Valid values are vto and skinAnalysis.
options

VtoExperienceOptions or SkinAnalysisExperienceOptions

YesExperience-specific options used to start the selected flow.
categoryString?Required for VTO if subCategory or skuId is not providedCategory to load when switching to AR Try-On.
subCategoryString?Required for VTO if category or skuId is not providedSubcategory to load when switching to AR Try-On.
skuIdString?Required for VTO if category or subCategory is not providedThe exact merchant SKU from variants[].skuId, not a product ID or variant UUID.
appIdStringRequired for Skin AnalysisSkin Analysis app ID to load when switching to Skin Analysis.

For AR Try-On, pass only one selector in a single call: category, subCategory, or skuId. Do not pass multiple selectors together, such as category with subCategory, because only one value will be used.

Selector values are trimmed. If multiple selectors are supplied, the SDK uses the first nonblank value in this priority order: category, then subCategory, then skuId. For example, if both category and subCategory are passed, a nonblank category will be preferred.

Listen to experience-changing, experience-changed, and experience-change-failed events to track switch progress and handle failures.

reset​

GlamAr.reset();

Removes all the current effects from the canvas.
Return Value: None

ParametersDescription

None

No parameters required.

close​

GlamAr.close();

Closes canvas and returns to the main widget page.
Return Value: None

ParametersDescription

None

No parameters required.

snapshot​

GlamAr.snapshot();

After a successfully scan, client can be get a PDF of his scan from share event
Return Value: none

ParametersDescription

None

No parameters required.

Events​

The GlamAR SDK emits various events throughout its lifecycle to help you monitor state, respond to user actions, and handle success or failure cases.

You can register for these events using the SDK's event listener system:

glamArView.addEventListener("loaded") {
// SDK has fully loaded
}

glamArView.addEventListener("skin-analysis") { data ->
// Handle skin analysis data
}

Each event is triggered from within the GlamAR SDK and may optionally include a payload, check Events Page for event details.