Truecaller SDK

Non Truecaller User Verification

This section defines the steps that can be used to trigger verification of non Truecaller app users which will be powered via Truecaller's drop call based verification flow
In order to verify both the Truecaller users (via OAuth Flow) and the non-Truecaller users (via manual verification), follow these steps :
  1. 1.
    Enable the Non Truecaller user verification capability for your app, by going to your project on the Truecaller developer portal and navigating to the bottom section
  1. 2.
    Configure sdkOptions in the TcSdkOptions Builder and supply a value of TcSdkOptions.OPTION_VERIFY_ALL_USERS to it like below.
val tcSdkOptions = TcSdkOptions.Builder(this, tcOAuthCallback)
. // other customizations (if any)
  1. 3.
    Configure permissions required by the SDK :
For Android 8 and above :
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="android.permission.READ_CALL_LOG"/>
<uses-permission android:name="android.permission.ANSWER_PHONE_CALLS"/>
For Android 7 and below :
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="android.permission.READ_CALL_LOG"/>
<uses-permission android:name="android.permission.CALL_PHONE"/>
  1. 4.
    Once you receive a callback in the TcOAuthCallback#onVerificationRequired(), you can initiate the verification for the user by calling the following method:
TcSdk.getInstance().requestVerification("IN", <PHONE_NUMBER>, verificationCallback, context);
}catch (RuntimeException e){
Log.i(TAG, e.getMessage());
Here -
  • the first parameter is the country code of the mobile number for which the verification needs to be triggered
  • the second parameter (PHONE_NUMBER_STRING) is the mobile number to be verified. Please ensure proper validations are in place so as to send correct phone number string to the above method, otherwise an exception would be thrown
  • the third parameter is an instance of VerificationCallback as defined here
  • the fourth parameter is an instance of FragmentActivity
Please note that Truecaller OAuth SDK v3.0.0 currently supports the verification for non-Truecaller users for Indian numbers only
  1. 5.
    Once you initiate the verification via TcSdk.getInstance().requestVerification() method, you will receive either a callback in your VerificationCallback instance with a specific requestType as described below
override fun onRequestSuccess(callbackType: Int,verificationDataBundle : VerificationDataBundle?) {
VerificationCallback.TYPE_MISSED_CALL_INITIATED)-> {
//missedcall initiated
if(verificationDataBundle != null){
verificationDataBundle.getString(VerificationDataBundle.KEY_TTL) verificationDataBundle.getString(VerificationDataBundle.KEY_REQUEST_NONCE)
VerificationCallback.TYPE_MISSED_CALL_RECEIVED)-> {
//missedcall received
VerificationCallback.TYPE_VERIFICATION_COMPLETE)-> {
//verification complete
VerificationCallback.TYPE_PROFILE_VERIFIED_BEFORE)-> {
//user already verified
override fun onRequestFailure(callbackType: Int, trueException : TrueException) {
onRequestSuccess() method is called under any of the following scenarios -
  • When drop call is successfully initiated for the input mobile number. In this case, you will get the callbackType as VerificationCallback.TYPE_MISSED_CALL_INITIATED
  • When drop call is successfully detected on that device by the SDK present in your app. In this case, you will get the callbackType as VerificationCallback.TYPE_MISSED_CALL_RECEIVED
  • When the verification is successful for a particular number. In this case, you will get the callbackType as VerificationCallback.TYPE_VERIFICATION_COMPLETE
  • When the user is already verified on that particular device before. In this case, you will get the callbackType as VerificationCallback.TYPE_PROFILE_VERIFIED_BEFORE
When callbackType is VerificationCallback.TYPE_MISSED_CALL_INITIATED, you will receive an additional parameter for the time to live i.e TTL (in seconds) which is passed as String extra in the VerificationDataBundle of onRequestSuccess().
This value determines amount of time left to complete the verification. You can use this value to show a waiting message to your user before they can try for another attempt.
Once the TTL expires, you can either auto-retry the verification by calling the requestVerification() method automatically with the same input parameters OR you can also take the user back to the number input screen to enter a different number for verification.
When the callbackType is VerificationCallback.TYPE_ALREADY_VERIFIED_BEFORE or VerificationCallback.TYPE_VERIFICATION_COMPLETE, it means that the user verification via Truecaller SDK is complete. In these cases, the SDK will share an additional access token with your application, which you may then use to validate the response at your server end. To fetch the access token, you may use the following code snippet :
//For when the control goes to TYPE_ALREADY_VERIFIED_BEFORE verificationDataBundle.getProfile().accessToken
//For when the control goes to TYPE_VERIFICATION_COMPLETE verificationDataBundle.getString(VerificationDataBundle.KEY_ACCESS_TOKEN)
Post fetching the access token, you may perform the server side validation by referring to the steps mentioned in the later part of the documentation here
onRequestFailure() method will be called when some error has occurred while verifying the provided mobile number. You will receive the appropriate error message from TrueException using TrueException#getExceptionMessage().For details of different possible error types you may encounter, please refer to the TrueException