private val kycResponseHandler: KycResponseHandler = object : KycResponseHandler {
override fun handleKycResponse(
json: String?,
result: VerificationResult
) {
when (result) {
is VerificationResult.ResultOk -> {
Toast.makeText(this@MainActivity, "ResultOk", Toast.LENGTH_SHORT).show()
}
is VerificationResult.ResultCanceled -> {
Toast.makeText(this@MainActivity, "ResultCanceled", Toast.LENGTH_SHORT).show()
}
}
Toast.makeText(this@MainActivity, "kycResponseHandler $json", Toast.LENGTH_SHORT).show()
}
}
Java
import java.util.HashMap;
// Inside your MainActivity class
// Call startKycVerification
FaceKi.startKycVerification(
this,
TEST_CLIENT_ID,
TEST_CLIENT_SECRET,
TEST_WORKFLOW_ID,
TEST_RECORD_IDENTIFIER,
kycResponseHandler
);
// Set custom logo
HashMap<FaceKi.IconElement, FaceKi.IconValue> iconMap = new HashMap<>();
iconMap.put(FaceKi.IconElement.Logo, new FaceKi.IconValue.Resource(R.drawable.logo));
FaceKi.setCustomIcons(iconMap);
// Set custom colors
HashMap<FaceKi.ColorElement, FaceKi.ColorValue> colorMap = new HashMap<>();
colorMap.put(FaceKi.ColorElement.BackgroundColor, new FaceKi.ColorValue.StringColor("#FFFFFF"));
FaceKi.setCustomColors(colorMap);
// Define KycResponseHandler
private KycResponseHandler kycResponseHandler = new KycResponseHandler() {
@Override
public void handleKycResponse(String json, VerificationResult result) {
if (result instanceof VerificationResult.ResultOk) {
Toast.makeText(MainActivity.this, "ResultOk", Toast.LENGTH_SHORT).show();
} else if (result instanceof VerificationResult.ResultCanceled) {
Toast.makeText(MainActivity.this, "ResultCanceled", Toast.LENGTH_SHORT).show();
}
Toast.makeText(MainActivity.this, "kycResponseHandler " + json, Toast.LENGTH_SHORT).show();
}
};
Custom colors
Use setCustomColors to customize the color scheme.
Kotlin
val colorMap = hashMapOf(
FaceKi.ColorElement.ButtonBackgroundColor to FaceKi.ColorValue.IntColor(myColorInt),
// Add other elements as needed
)
FaceKi.setCustomColors(colorMap)
Java
HashMap<FaceKi.ColorElement, FaceKi.ColorValue> colorMap = new HashMap<>();
colorMap.put(FaceKi.ColorElement.BackgroundColor, new FaceKi.ColorValue.StringColor("#FFFFFF"));
FaceKi.setCustomColors(colorMap);
Custom logo
Use setCustomIcons to customize the icons.
Kotlin
val iconMap = hashMapOf(
FaceKi.IconElement.Logo to FaceKi.IconValue.Resource(myDrawableResId),
// Add other elements as needed
)
FaceKi.setCustomIcons(iconMap)
Java
HashMap<FaceKi.IconElement, FaceKi.IconValue> iconMap = new HashMap<>();
iconMap.put(FaceKi.IconElement.Logo, new FaceKi.IconValue.Resource(R.drawable.ic_launcher_background));
FaceKi.setCustomIcons(iconMap);
Response Handling
The response from KYC verification is a plain JSON object.
You can convert this response into a JSON object using serialization libraries like Gson or Moshi.
Methods
startKycVerification: Initiates the KYC verification process.
setCustomColors: Customizes the colors of various UI elements.
setCustomIcons: Customizes the icons used in the UI.
Enums and Sealed Classes
ColorElement
Enum defining different UI elements that can have their colors customized.
ColorValue
Sealed class representing a color value.
Types:
IntColor: Represents color as an integer.
StringColor: Represents color as a string (e.g., "#FFFFFF").
IconElement
Enum defining different UI elements that can have their icons customized.