Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The Truecaller React Native SDK documentation does not explain verification procedure for the Non-Truecaller users. #10

Open
Sine99 opened this issue Aug 28, 2021 · 15 comments

Comments

@Sine99
Copy link

Sine99 commented Aug 28, 2021

While the documentation for the existing Truecaller users is explained and works fine on implementation, but for non-truecaller users, there is hardly any content for the react native developers.

I went through the android installation guide and docs. Everything is implemented in java and trying to make it work for the react native projects has become headache. I have been splitting my hair for the last two days but with no success. There is hardly any content on the internet which explains about the set-up for non-truecaller users.

I will be very thankful if you could help me with this as I urgently require it for my project. Integrating Truecaller sdk has been very smooth and easy. I would ask you to please add the documentation part for non-truecaller users.

@vasu2001
Copy link

From the android docs, I tried updating this line in TruecallerAuthModule.java
.sdkOptions(TruecallerSdkScope.SDK_OPTION_WITH_OTP)

Earlier when truecaller app was not installed there was no response, no error. Now I am receiving an error
[Error: Only the original thread that created a view hierarchy can touch its views.]
Anyone with android experience might be able help?

@lavishaggarwal
Copy link

Facing same issue, any resolution on same?

@srinivasNativeDeveloper
Copy link

srinivasNativeDeveloper commented May 3, 2022

The error that you are facing can be resolved by using runOnUiThread in a way so that the UI can be updated with our non-truecaller user verification disclaimer.

While calling TruecallerSDK.getInstance.getUserProfile() method you need to wrap it like this :

UiThreadUtil.runOnUiThread(new Runnable()
{
@Override public void run()
{
TruecallerSDK.getInstance().getUserProfile(<<Activity/Fragment>>);
}
});
official reply from truecaller team

incase you face this error cannot find symbol UiThreadUtil.runOnUiThread(new Runnable()

then just add this import statement in your activity import com.facebook.react.bridge.UiThreadUtil;

@aparnagude396
Copy link

Hi,
I'm not getting any response or error while if user is not login into truecaller app. Can anyone please help me.

@srinivasNativeDeveloper

TruecallerSDK.getInstance().isUsable()
this will return if the trucaller app is installed and also the user logged in using this in your truecallerAuthModule you can reject the promise with your own error message.

@aparnagude396
Copy link

Hi @srinivasNativeDeveloper ,
Can you please check the below code
@ReactMethod
public void authenticate(Promise promise) {
try {
// this.promise = promise;
if (TruecallerSDK.getInstance() != null) {
if(TruecallerSDK.getInstance().isUsable()){
TruecallerSDK.getInstance().getUserProfile((FragmentActivity) getCurrentActivity());
}

//For One-Tap implementation : The isUsable method would return true incase where the truecaller app is installed and logged in else it will return false.
//For Full-Stack implementation : The isUsable method would always return true as now the SDK can be used to verify both truecaller and non-truecaller users

       } else {
              WritableMap map = Arguments.createMap();
              map.putString("error", "ERROR_TYPE_NOT_SUPPORTED");
              promise.resolve(map);
      }
  } catch (Exception e) {
          promise.reject(e);
       }
   }  

here in react native I'm calling this authenticate method.

@srinivasNativeDeveloper
try {
// this.promise = promise;
if (TruecallerSDK.getInstance() != null) {
if(TruecallerSDK.getInstance().isUsable()){
TruecallerSDK.getInstance().getUserProfile((FragmentActivity) getCurrentActivity());
} else{
        promise.reject("TrueCaller Not Installed / User not logged in");
  }

//For One-Tap implementation : The isUsable method would return true incase where the truecaller app is installed and logged in else it will return false.
//For Full-Stack implementation : The isUsable method would always return true as now the SDK can be used to verify both truecaller and non-truecaller users

       } else {
              WritableMap map = Arguments.createMap();
              map.putString("error", "ERROR_TYPE_NOT_SUPPORTED");
              promise.resolve(map);
      }
  } catch (Exception e) {
          promise.reject(e);
       }
   }  

else{
promise.reject("TrueCaller Not Installed / User not logged in");
} // adding this else block under isUsable() condition will do the job

@aparnagude396
Copy link

Thanks @srinivasNativeDeveloper. Working now.

@srinivasNativeDeveloper

@aparnagude396 Happy to help you.

@aparnagude396
Copy link

Hi @srinivasNativeDeveloper,
I have one scenario, if user installed the truecaller app but not logged in. How to login the truecaller directly from our app. At present we are showing alert msg like "user is not logged in" using isusable method. Can you please help me out.

@srinivasthedeveloper
Copy link

@aparnagude396 can you provide some more details for the above scenario?

@aparnagude396
Copy link

In my app I have provided truecaller login to the user. If the user is loggedin to the truecaller app in his mobile, In that case I can able to get the mobile details from truecaller app into our app. But if user has installed truecaller and loggedin to the app in his mobile, in that case I can't able to get the mobile details from truecaller app. so I'm showing user is not loggedinto truecaller app. But my client asked that if user is not loggedinto truecaller , in that case instead of showing error message we have to give provision to login into trucaller directly from our app.

@srinivasthedeveloper
Copy link

srinivasthedeveloper commented Jan 2, 2023

@aparnagude396 i sense that you are asking a way to verify non-truecaller users which may be done with the help of below requestverification flow.

try{ TruecallerSDK.getInstance().requestVerification("IN", PHONE_NUMBER_STRING, apiCallback, ExampleActivity.this); }catch (RuntimeException e){ Log.i(TAG, e.getMessage()); }
https://docs.truecaller.com/truecaller-sdk/android/integrating-with-your-app/verifying-non-truecaller-users (above method documentation)
https://docs.truecaller.com/truecaller-sdk/android/integrating-with-your-app/verifying-non-truecaller-users/completing-verification (callback)
https://docs.truecaller.com/truecaller-sdk/android/server-side-response-validation/for-non-truecaller-users-verification-flow (api)

@aparnagude396
Copy link

@srinivasNativeDeveloper I'll try and let you know.

@pankaj9296
Copy link

How to get the Sms Retriever hash code for an Expo app?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants