Truecaller SDK
  • Hello!
  • Why Truecaller SDK
  • Getting Started
  • ANDROID
    • 🆕OAuth SDK 3.0
      • Implementing user flow for your App
      • Scenarios for all user verifications : Truecaller and Non Truecaller Users
      • Integration Steps
        • Generating Client ID
        • Setup
        • Implementing Callbacks
        • Initialisation
        • Setting up OAuth parameters
        • Invocation
        • Customisation
        • Clearing SDK Instance
        • Handling Error Scenarios
        • Integrating with your Backend
          • Fetching User Token
          • Fetching User Profile
        • Non Truecaller User Verification
          • Completing Verification
          • TrueException
          • Server Side Validation
      • Instrumentation
      • Getting Release Ready
        • Testing your verification flow
          • Non-Truecaller user verification flow
          • Truecaller user verification flow
          • Test Setup
        • Google play store app permission declaration form
        • Moving to Production
    • SDK v2.8.0
      • Implementing user flow for your app
      • Scenarios for all user verifications : Truecaller and Non Truecaller Users
      • Generating App Key
      • Integrating with your App
        • Setup
        • App Key Configuration
        • Initialisation
        • Customisation
        • Implement Callbacks
        • Clearing SDK instance
        • Handling Error Scenarios
        • Verifying non Truecaller users
          • TrueException
          • Completing Verification
        • Advanced Steps
      • Server Side Response Validation
        • For Truecaller users verification flow
        • For Non-Truecaller users verification flow
      • Instrumentation
      • Getting Release Ready
        • Testing your verification flow
          • Truecaller user verification flow
          • Non-Truecaller User Verification Flow
          • Test Setup
        • Google Play App Signing
        • Google Play Store app permissions declaration
        • Google Play Policy Change for Device Identifiers
      • Changelog
  • MOBILE WEBSITES
    • Implementing user flow for your Mobile Website
    • Generating App Key
    • Integrating with your mobile website
      • Initialisation
      • Invoking verification
      • Fetch User Profile
      • Completing User Verification
      • Handling Error Scenarios
    • Getting Release Ready
      • Instrumentation
      • Testing your verification flow
  • IOS
    • Generating App Key
    • Integrating with your iOS App
      • Setup
      • Configuration
      • Usage
        • Swift
        • Objective-C
      • Verifying Non-Truecaller app users
        • Completing Verification
      • Handling Error Scenarios
        • Safari Redirection
    • Server Side Response Validation
  • SHOPIFY APP
    • Generating App Key
    • App Configuration
    • Deactivating App Block
  • FAQs
    • General
    • Developer Account
    • Android App SDK
    • Android OAuth SDK
    • Mobile Web SDK
    • Number Verification Plugin
  • PRODUCT UPDATES
    • App Review Process
    • Introducing dark theme
Powered by GitBook
On this page

Was this helpful?

  1. ANDROID
  2. SDK v2.8.0
  3. Integrating with your App

Implement Callbacks

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

@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (requestCode == TruecallerSDK.SHARE_PROFILE_REQUEST_CODE) {
       TruecallerSDK.getInstance().onActivityResultObtained(this, requestCode, 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(@Nullable final TrueError trueError) {
     }
     
 };

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.

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

PreviousCustomisationNextClearing SDK instance

Last updated 4 years ago

Was this helpful?

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 .

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. Also, you'll get a only when TC app is installed and user is logged in. For other cases, it would be null. This optional TrueError can be used to determine the user action that led to initiating manual verification. So using this TrueError, you can get to whether the user pressed on the footer CTA on the verification screen OR the system back button.

here
Nullable TrueError