Failure/ Error responses
The "onFailure" callback method that you just implemented in the previous step helps you to handle all the possible failure cases when the user couldn't be verified successfully via the Truecaller flow.
Below are some of the possible failure scenarios and the corresponding error response that you receive for each of the cases :
Error Description | Error Code |
---|---|
Please note that when you encounter any of the error scenarios and get the control in the "onFailure()" method, you should redirect the user to your alternate verification flow.
Exceptions
In case you face any of the following run time exceptions, please follow the recommended steps as mentioned below :
"No compatible client available. Please change your scope"
As the exception suggests, you are trying to call an SDK method even though no client is available to handle it. This usually happens if you have initialized the SDK using ONLY_TC_USERS scope option i.e to verify only the Truecaller users, and you are not calling isOAuthFlowUsable() method before calling an SDK method. To resolve this, call isOAuthFlowUsable() before calling any SDK method if you are using VERIFY_TC_USERS scope option.
"Please call init() on TruecallerSDK first"
This exception suggests that you are trying to call an SDK method before the SDK has been initialised. To resolve it, check for all possible user flows in your app which could lead to calling an SDK method directly before it has been initialised.
"Add client id in your manifest"
This exception suggests that you are trying to call SDK initialization/build method without having your clientID mentioned in your manifest as meta-data.
"OAuth scopes cannot be null or empty"
This exception suggests that you are trying to call SDK method - getAuthorisationCode before setting up the OAuth scopes.
"OAuth state cannot be null or empty"
This exception suggests that you are trying to call SDK method - getAuthorisationCode before setting up the OAuth state.
“Code challenge cannot be null or empty”
This exception suggests that you are trying to call SDK method - getAuthorisationCode before setting up the Code challenge.
"Something went wrong"
0
"Device is not supported"
16
"Truecaller user has an invalid account state"
10
"Invalid partner or partner information is missing"
12
"Conflicting request code possible in onActivityResult()"
6
"Truecaller app closed unexpectedly"
7
"Truecaller app is not installed/loggedin"
5
"User denied by pressing the footer button"
11
"User denied by dismissing consent screen"
14
"User denied while loading"
2
"Truecaller sdk is old and not compatible"
6