Completing Verification

Once you receive a callback in your VerificationCallback instance with the requestCode TYPE_MISSED_CALL_RECEIVED or TYPE_OTP_RECEIVED , you can complete the verification process by calling the following method from within your activity :

TrueProfile profile = new TrueProfile.Builder(firstName, lastName).build();

You need to create a TrueProfile instance by passing the user's first and last name as defined above.

Please note that the first name and last name values to be passed in the above method call need to follow below mentioned rules : - The strings need to contains at least 1 alphabet, and cannot be completely comprised of numbers or special characters - String length should be less than 128 characters - First name is a mandatory field, last name can be empty ( but non nullable )

Depending on whether the verification medium is drop call or OTP, you need to call one of the following methods respectively:

Dropcall
OTP
Dropcall
TruecallerSDK.getInstance().verifyMissedCall(profile, apiCallback)

You need to call this method once you have received callback with requestCode as TYPE_MISSED_CALL_RECEIVED in your VerificationCallback instance

OTP
TruecallerSDK.getInstance().verifyOtp(profile, OTP, apiCallback)

You need to call this method once you have received the callback in your VerificationCallback instance with requestCode as TYPE_OTP_RECEIVED and the OTP as a string in VerificationDataBundle

If your input mobile number is not present on the same device, you need to ask the user to input the OTP manually in case of OTP based verification

After you call the above method, you will receive a callback in your VerificationCallback instance with requestCode as TYPE_VERIFICATION_COMPLETE, which completes your verification process.

Whenever you get the verification callback with requestType as TYPE_VERIFICATION_COMPLETE, you would get an accessToken as a parameter in the verificationDataBundle. You can use this access token to validate the authenticity of the verification flow by making an API call from your server to Truecaller's server. For details on this part, please refer here.