Initialization
Initialize the SDK on application load — typically in the Application class or in the onCreate of your entry Activity. SDK authentication with the backend takes a few seconds, so initializing early avoids lag between the user tapping the capture button and the camera opening. See Best practices for more details.
Create a class that implements AcessoBioConfigDataSource and exposes the credentials obtained from the Onboarding team:
- Kotlin
- Java
import com.acesso.acessobio_android.onboarding.AcessoBioConfigDataSource
class UnicoConfig : AcessoBioConfigDataSource {
override fun getBundleIdentifier(): String = BUNDLE_IDENTIFIER
override fun getHostKey(): String = SDK_KEY
}
import com.acesso.acessobio_android.onboarding.AcessoBioConfigDataSource;
public class UnicoConfig implements AcessoBioConfigDataSource {
@Override
public String getBundleIdentifier() {
return BUNDLE_IDENTIFIER;
}
@Override
public String getHostKey() {
return SDK_KEY;
}
}
The choice between sandbox and production is made during initialization. Pass the desired environment via setEnvironment when building the SDK instance:
- Kotlin
- Java
var acessoBioBuilder: IAcessoBioBuilder = AcessoBio(activity, createCallback()).apply {
setEnvironment(Environment.UAT)
}
IAcessoBioBuilder acessoBioBuilder = new AcessoBio(activity, createCallback());
acessoBioBuilder.setEnvironment(Environment.UAT);
For the full list of available environment types, refer to API Reference > Initialization API.
Build the UnicoCheckCamera instance from the acessoBioBuilder, configuring smart capture behaviour and locale:
- Kotlin
- Java
val unicoCheckCamera: UnicoCheckCamera = acessoBioBuilder
.setAutoCapture(true)
.setSmartFrame(true)
.setLocale(LocaleTypes.EN_US)
.build()
UnicoCheckCamera unicoCheckCamera = acessoBioBuilder
.setAutoCapture(true)
.setSmartFrame(true)
.setLocale(LocaleTypes.EN_US)
.build();
The true/false values for setAutoCapture and setSmartFrame do not alter the capture experience — they are used only for the internal logic of the SDK.