SDK Integration(Android)
Integration Documentation for Android Solution SDK.
Overview
- Minimum Android version:
4.4 (API Level:19) - Compilation Android SDK version:
API Level:35 - Target Android SDK version:
API Level:35 - Supported CPU architectures:
armeabi-v7a,arm64-v8a - SDK incremental package size:
~0.9MB
Installation
- Add the maven URL to your settings.gradle file.
dependencyResolutionManagement { repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) repositories { google() mavenCentral() maven { url 'https://public-n3.advai.net/repository/maven-releases/' } } } - Add the dependency in app/build.gradle.
dependencies { implementation "ai.advance.mobile-sdk.android:solution-lib:1.4.4" } - For projects that use AndroidX, it is necessary to add the following lines to the gradle.properties file:
android.useAndroidX=true android.enableJetifier=true
Quick Start
- Declare the following permissions in the XML file.
<uses-permission android:name="android.permission.CAMERA" /> <uses-permission android:name="android.permission.INTERNET" /> - Initialize the SDK in your application.
public class MainApplication extends Application { @Override public void onCreate() { super.onCreate(); GuardianSolutionSDK.init(this); } } - Sets the appearance mode.
Options: LIGHT, DARK, FOLLOW_SYSTEM.
Default: LIGHT.GuardianSolutionSDK.setThemeType(ThemeType.FOLLOW_SYSTEM); - Sets the loading color of the page for both light and dark appearance modes.The provided color value must be in ARGB or RGB format.
This can be specified as an ARGB hex string:
Alternatively, you can use a native resource ID:GuardianSolutionSDK.setThemeColors( new Colors.Builder().setPrimaryColor("#FF000000").build(), new Colors.Builder().setPrimaryColor("#FFFFFFFF").build() );GuardianSolutionSDK.setThemeColors( new Colors.Builder().setPrimaryColor(R.color.xxx).build(), new Colors.Builder().setPrimaryColor(R.color.xxx).build() ); - Starts the Solution flow. Pass in your own URL and a callback listener to receive the result.
For detailed return values, please consult the [documentation link].
GuardianSolutionSDK.start(this, url, result -> { Log.d("SolutionResult", "Code: " + result.getCode() + "\nterminated: " + result.isTerminated() + "\n" + "SignatureId: " + result.getSignatureId() + "\n" + "finishRedirectUrl: " + result.getFinishRedirectUrl() + "\nextraInfo: " + result.getExtraInfo()); if (result.isTerminated()) { // The flow was terminated. You can provide a corresponding prompt based on result.getCode(). } else { if ("FINISH".equalsIgnoreCase(result.getCode())) { // The flow finished normally. Process the result. Map<String, Object> extraInfo = result.getExtraInfo(); if (extraInfo != null && "SUBMITTED".equalsIgnoreCase(String.valueOf(extraInfo.get("submissionStatus")))) { // KYC data was submitted successfully. } else { // Submission failed. At this point, you can get an error code from extraInfo // and implement other logic based on the code, such as re-selecting a document. } } else { // This branch currently only handles the USER_GIVE_UP case. } } });
Release Notes
Updated about 1 month ago
