Skip to main content

ReactNative API References

Initialization Method​

To get started, call the GlamAr.init method. This adds the GlamAr SDK into the target container and configures it with the provided Access key and optional configuration.

const config: GlamArConfig = {
accessKey: "Your_Access_Key", // required
category: "skinanalysis",
configuration: {
skinAnalysis: {
appId: "Your_SkinApp_Id", // required
},
},
meta: {
preloadMLModels: ["face", "light"],
},
};
GlamAr.init(config);

Initialization Config​

ParametersTypeDescriptionOptions
accessKeystringPass your unique Access Key
categorystringPass skinanalysis
appIdstringPass any skinAnalysis app's appId
meta.preloadMLModelsstring[]Downloads the listed ML models during SDK initialization. Skin Analysis supports face and light.["face", "light"]

Example​

const config: GlamArConfig = {
accessKey: "Your_Access_Key", // required
category: "skinanalysis",
configuration: {
skinAnalysis: {
appId: "Your_SkinApp_Id", // required
},
},
meta: {
preloadMLModels: ["face", "light"],
},
};

GlamAr.init(accessKey, config);

Post-Initialization Methods​

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.

skinAnalysis​

GlamAR.skinAnalysis("start");

Opens the Skin Analysis flow.
Return Value: None

ParametersDescriptionTypeOptions
optionsPass start (Required)stringstart

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.

back​

GlamAR.back();

To simulate back button without using UI
Return Value: None

ParametersDescription
None No parameters required.

Events​

Check Events Page for event details.