Implement Callbacks

7. Add the following condition in the onActivityResult method TruecallerSDK.getInstance().onActivityResultObtained( this,resultCode, data)

@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
TruecallerSDK.getInstance().onActivityResultObtained(this, resultCode, data);
}

Note : In case you passed Fragment in the getUserProfile() method [ point #6 ], override the onActivityResult() method in your corresponding Fragment

8. In your selected Activity/Fragment, either make the component implement ITrueCallback or create an instance of it :

private final ITrueCallback sdkCallback = new ITrueCallback() {
@Override
public void onSuccessProfileShared(@NonNull final TrueProfile trueProfile) {
}
@Override
public void onFailureProfileShared(@NonNull final TrueError trueError) {
}
@Override
public void onVerificationRequired() {
}
};

onSuccessProfileShared() method will be called in either of the following two scenarios : a.) When the user has agreed to share his profile information with your app by clicking on the "Continue" button on the Truecaller dialog b.) When a non Truecaller user is already verified previously on the same device. This would only happen when the TruecallerSdkScope#SDK_OPTION_WITH_OTP is selected while initialising the SDK to provision for the verification of non-Truecaller users also.

onFailureProfileShared() method will be called when some error occurs or if an invalid request for verification is made. You'll get the respective error code as per the details mentioned here.

onVerificationRequired() method will only be called whenTruecallerSdkScope#SDK_OPTION_WITH_OTP is selected. This will be called when the user is not a Truecaller app user

Write all the relevant logic in the above callback methods to handle the scenarios appropriately