Ana içeriğe geç

Android

Platform

artlabs introduces tailor-made AR-commerce. A specially designed, effortless, 3D-powered boost for eCommerce. Meshkraft is the platform that enables brands to create and deploy 3D models of their products in AR.

Installation

Make sure you add jitpack repository to your project level build.gradle file.

allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}

Add the following dependency to your app level build.gradle file.

dependencies {
implementation 'com.github.ARTLabs-Engineering.Meshkraft-Android:meshkraft:1.4.1'
}

Usage

Following features written using Kotlin. If you are using Java, you can use the same methods with the same parameters.

Initialization

  1. Import the library
import com.artlabs.meshkraft.Meshkraft
  1. Set your API key
class MyApplication:Application() {
override fun onCreate() {
super.onCreate()
Meshkraft.setApiKey("YOUR_API_KEY")
}

}
uyarı

Make sure to replace YOUR_API_KEY with your API key.

AR Session


import com.artlabs.meshkraft.IMeshkraftState
import com.artlabs.meshkraft.Meshkraft
import com.artlabs.meshkraft.data.model.Mode


Meshkraft.startArSession(
context,
"productSKU",
mode, // not required. possible values are: PREFERRED_3D, ONLY_3D, AR_PREFERRED, AR_ONLY
listener=object:IMeshkraftState{
override fun onLoading() {
// on loading
}

override fun onFail(message: String) {
// any fail on session
}

override fun onFinish() {
// session done. started intent
}
}
)

or you can use a basic starter.

 Meshkraft.startBasicArSession(context, "productSKU")

VTO Session


Meshkraft.startVTOSession(
context,
"productSKU",
)

Java

  1. Add The Following Application class.
public class MainActivity extends Activity  {
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

Meshkraft.INSTANCE.setApiKey("YOUR_API_KEY");
}
}

Make sure to replace YOUR_API_KEY with your application token.

AR Session

Meshkraft.INSTANCE.startArSession(
context,
"productSKU",
mode,// nullable
new IMeshkraftState() {
@Override
public void onLoading() {
// Loading State
}

@Override
public void onFail(@NonNull String message) {
// onFail state
}

@Override
public void onFinish() {
// finish session
}
}
);

or you can a use basic starter.

    Meshkraft.INSTANCE.startBasicArSession(context,"productSKU");

VTO Session

Meshkraft.INSTANCE.startVTOSession(
context,
"productSKU",
);