Android Framework API References
Initialization Method
GlamAr.init(
context: Context,
accessKey: String,
overrides: GlamAROverrides? = null,
webView: WebView? = null,
debug: Boolean = false
)
Parameter Descriptions
| Parameter | Type | Required | Description |
|---|---|---|---|
| context | Context | Yes | The Android context, typically passed from an Activity or Fragment. Used for WebView creation and permission handling. |
| accessKey | String | Yes | Your unique Access key to authenticate the SDK usage. |
| overrides | GlamAROverrides? | No | Configuration object to control AR behavior, UI, and metadata. See GlamAROverrides for details. |
| webView | WebView? | No | If provided, the SDK will use this WebView instance instead of creating a new one. Allows full control over rendering. Defaults to null. |
| debug | Boolean | No | Enables 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
| Parameters | Description | Type | Options |
|---|---|---|---|
| options | Pass start (Required) | string | start |
addEventListener
GlamAr.addEventListener(eventName, handlerFunction);
Adds the listener to the given event name.
Return Value: None
| Parameters | Type | Description |
|---|---|---|
| eventName | string | A Name of specific event or "*" To listen to the all the events. |
| handlerFunction | function | Your handler function that will listen to callback. |
removeEventListener
GlamAr.removeEventListener(eventName, handlerFunction);
Removes the given listener for the event name.
Return Value: None
| Parameters | Type | Description |
|---|---|---|
| eventName | string | A Name of specific event or "*" To remove all the events. |
| handlerFunction | function | Your handler function that will listen to callback. |
isLoaded
GlamAr.isLoaded();
Returns the status of module loading.
Return Value:trueif loaded, otherwisefalse
| Parameters | Description |
|---|---|
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")
)
| Parameters | Type | Required | Description |
|---|---|---|---|
| experience | String | Yes | Experience to switch to. Valid values are vto and skinAnalysis. |
| options |
| Yes | Experience-specific options used to start the selected flow. |
| category | String? | Required for VTO if subCategory or skuId is not provided | Category to load when switching to AR Try-On. |
| subCategory | String? | Required for VTO if category or skuId is not provided | Subcategory to load when switching to AR Try-On. |
| skuId | String? | Required for VTO if category or subCategory is not provided | The exact merchant SKU from variants[].skuId, not a product ID or variant UUID. |
| appId | String | Required for Skin Analysis | Skin 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
| Parameters | Description |
|---|---|
None | No parameters required. |
close
GlamAr.close();
Closes canvas and returns to the main widget page.
Return Value: None
| Parameters | Description |
|---|---|
None | No parameters required. |
snapshot
GlamAr.snapshot();
After a successfully scan, client can be get a PDF of his scan from
shareevent
Return Value: none
| Parameters | Description |
|---|---|
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.