Failure/ Error responses
The "onFailureProfileShared" 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 Type 4 and Error Type 10 could arise in different conditions depending on whether the user has not registered on Truecaller app on their smartphone or if the user has deactivated their Truecaller profile at any point of time from the app.
Apart from the above mentioned error cases, there are few other error scenarios that you may encounter under rare circumstances. For complete and exhaustive list of all the error cases, you can refer to TrueError.class within the SDK.
Please note that when you encounter any of the error scenarios and get the control in the "onFailureProfileShared()" 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 initialised the SDK using WITHOUT_OTP scope option i.e to verify only the Truecaller users, and you are not calling isUsable()
method before calling an SDK method. To resolve this, call isUsable()
before calling any SDK method if you are using WITHOUT_OTP 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.
Error Code
What it means
1
Network Failure
2
User pressed back
3
Incorrect Partner Key
4 & 10
User not Verified on Truecaller*
5
Truecaller App Internal Error
13
User pressed back while verification in process
14
User pressed footer CTA (" USE ANOTHER NUMBER")
15
To handle ActivityNotFound Exception, in case Truecaller app fails to initiate