GlamAR is a powerful Augmented Reality SDK for Android that enables virtual try-on experiences for makeup, jewelry, and other beauty products. The SDK provides an easy-to-integrate solution with real-time AR capabilities, face detection, and product visualization features.
- Real-time virtual makeup try-on
- Multiple product category support
- Camera and image-based preview modes
- Real-time face tracking and analysis
- Easy integration with Android applications
- Snapshot functionality
- High-performance WebView-based rendering
- Original/Modified view comparison
- Configurable parameters
The GlamAR SDK is available on Maven Central. Add the following dependency to your app's build.gradle:
dependencies {
implementation 'io.pixelbin.glamar:glamar:1.0.1'
}Alternatively, you can manually include the .aar file:
- Place the
.aarfile in your project'slibsdirectory - Add the following to your app's
build.gradle:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
implementation 'com.google.code.gson:gson:2.10.1'
implementation 'com.squareup.okhttp3:okhttp:4.11.0'
}Add these permissions to your AndroidManifest.xml:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA" /> <!-- Required for camera preview mode -->Initialize the SDK in your Application class:
class MyApplication : Application() {
override fun onCreate() {
super.onCreate()
GlamAr.initialize(
context = this,
accessKey = "YOUR_ACCESS_KEY",
debug = BuildConfig.DEBUG, // Set to true for development environment
previewMode = PreviewMode.Camera // Or PreviewMode.Image for image-based preview
)
}
}- Add GlamArView to your layout:
<io.pixelbin.glamar.GlamArView
android:id="@+id/glamARView"
android:layout_width="match_parent"
android:layout_height="match_parent" />- Setup callbacks and handle events:
glamARView.setCallback(object : GlamArCallback {
override fun onError(error: String) {
// Handle error
}
override fun onSuccess(message: String) {
// Handle success
}
override fun onSnapshotTaken(base64Image: String) {
// Handle snapshot image
}
})// Camera preview mode
glamARView.startPreview(previewMode = PreviewMode.Camera)
// Image preview mode
glamARView.startPreview(previewMode = PreviewMode.Image(imageUrl = "IMAGE_URL"))
// No preview mode
glamARView.startPreview(previewMode = PreviewMode.None)// Apply a specific SKU
glamARView.applySku(skuId = "SKU_ID")
// Clear applied products
glamARView.clear()// Take a snapshot
glamARView.snapshot()
// Toggle between original and modified view
glamARView.toggle(showOriginal = true)// Adjust various parameters
glamARView.configChange(options = "brightness", value = 1.2)// Fetch SKU list
GlamAr.getInstance().api.fetchSkuList(pageNo = 1, pageSize = 20) { result ->
result.onSuccess { response ->
// Handle SKU list
}.onFailure { exception ->
// Handle error
}
}
// Fetch specific SKU details
GlamAr.getInstance().api.fetchSku(id = "SKU_ID") { result ->
result.onSuccess { item ->
// Handle SKU details
}.onFailure { exception ->
// Handle error
}
}- Always handle permissions appropriately:
override fun onRequestPermissionsResult(
requestCode: Int,
permissions: Array<out String>,
grantResults: IntArray
) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
glamARView.onRequestPermissionsResult(requestCode, grantResults)
}- Initialize the SDK early in your application lifecycle
- Handle callbacks for better user experience
- Use appropriate preview modes based on your use case
- Implement proper error handling
- 1.0.1 (Latest)
- Maven Central release
- Enhanced face tracking
- Improved performance
- Bug fixes and stability improvements
For support and bug reports, please create an issue in our GitHub repository or contact our support team at [email protected].
GlamAR SDK is available under the MIT license. See the LICENSE file for more info.