Skip to main content

Android SDK Migration

warning

To upgrade to Core AmaniSDK v3, you need to use it with the AmaniUI package.

Amani SDK Initialization


Amani.init(this,"server","SHARED_SECRET"); // WARNING! It must be called at least once before other functions are called.
// If you want to disable Signature, leave SHARED_SECRET as empty.
// SHARED_SECRET will be provided from Amani if needed.


Amani.goToKycActivity(
this,
"ENTER TCIN NO HERE", //(Can not be null or empty)
"ENTER TOKEN HERE", //(Can not be null or empty)
"ENTER BIRTH DATE HERE", // YYMMDD format. (For Example: 20 May 1990 is 900520). (Can be empty if NFC is not used.)
"ENTER EXPIRE DATE HERE", // YYMMDD format.(Can be empty if NFC is not used.)
"ENTER DOCUMENT NO HERE", // Document number of your ID card. (Can be empty if NFC is not used.)
"ENTER GEOLOCATION PERMISSION", // Boolean value of your geoLocation value(true/false). (Default value: true)
"ENTER LANGUAGE", // Language of your current application. (tr,en,zh etc.) (Default value: "tr")
"ENTER USER's EMAIL", // Must be in EMAIL format! (@Nullable or empty if not needed.)
"ENTER USER's PHONE NUMBER", // Phone number of user. (@Nullable or empty if not needed.)
"ENTER FULL NAME OF USER" // Full name of user. (@Nullable or empty if not needed.)

);

On Activity Result


override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)

//Getting verification status true/false as boolean return.
val verificationCompleted = Objects.requireNonNull(data)!!.getBooleanExtra("ON_SUCCESS", false)

//Getting token status true/false as boolean return.
val tokenExpired = Objects.requireNonNull(data)!!.getBooleanExtra("TOKEN_EXPIRED", false)

//Getting network connection true/false
val networkError = Objects.requireNonNull(data)!!.getBooleanExtra("ON_NETWORK_ERROR", false)

//Getting HTTPS's error codes if there is any API exception.
val apiException = Objects.requireNonNull(data)!!.getIntExtra("ON_API_EXCEPTION", 10000)

//Getting list of KYC steps's information.
try {
var stepList: Map<String, String>? = null
stepList = SessionManager.getRules()
}catch (e: Exception) {
Log.d("TAG", "onActivityResult: stepList is null")}


if (verificationCompleted) {
//Do something!
}

if (tokenExpired) {
//Your token is expired.
}

if (networkError){
// Check your internet connection, please.
}

if (apiException == 401) // HTTPS Error: 401
//... //HTPS Error: apiException
//... //HTPS Error: apiException
//... //HTPS Error: apiException

}

You can get more detailed information about the messages coming from AmaniUI Listeners from this link. Profile Status