Initialisation
Last updated
Last updated
6. Create a TruecallerSdkScope object by using the appropriate configurational settings and use it to initialise the TruecallerSDK in your android activity's onCreate method :
Copy
You will find complete details on the configuration options in the TruecallerSdkScope object as described above, and all the possible available values in the immediate next section of this documentation .
Truecaller SDK needs to be initialised only once and the same instance can be accessed at any place within your app, without the need to initialise it again, via TruecallerSDK.getInstance()
Once you initialise the TruecallerSDK using the init() method, if you are using the SDK for verification of only Truecaller users ( by setting the sdkOptions scope as TruecallerSdkScope.SDK_OPTION_WITHOUT_OTP ), you can check if the Truecaller app is present on the user's device or not by using the following method
Copy
You can trigger the Truecaller profile verification dialog anywhere in your app flow by calling the following method
Copy
You can trigger the Truecaller profile verification dialog anywhere in your app flow by calling the following method
Copy
Here, sdkCallback is an interface that you need to define in your app where you would get the success or failure callbacks. You will find details about the implementation in this .
If you want to use the SDK for verification of Truecaller users as well as non-Truecaller users powered by Truecaller's drop call / OTP ( for implementation details, refer section ), you should provide the scope value as TruecallerSdkScope.SDK_OPTION_WITH_OTP
In case isUsable() method returns false, implying that Truecaller app is not present on the device, you can take the user to your app screen and continue with the OR choose to use your own verification flow [ Refer image below ].