19

I am trying to implement the Truecaller android-SDK for Sign In/Sign Up on one of my personal app. I received the partner key from truecaller to implement it in my app. Error occurs on pressing 'Autofill with truecaller' returns the 'Error Code 3' on 'trueError.getErrorType( )' in 'public void onFailureProfileShared()'. I can't seem to find the method for describing the error. Does anyone happen to know to fix this error?

My implementation:

public class auth extends AppCompatActivity implements ITrueCallback{ private TrueButton truebutton = null; private TrueClient trueClient = null; private String mTruecallerRequestNonce = null; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_auth); truebutton = (TrueButton) findViewById(R.id.com_truecaller_android_sdk_truebutton); boolean isUsable = truebutton.isUsable(); if(isUsable) { trueClient = new TrueClient(auth.this, auth.this); truebutton.setTrueClient(trueClient); } else { truebutton.setVisibility(View.GONE); } truebutton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { trueClient.getTruecallerUserProfile(auth.this); } }); } @Override protected void onResume() { mTruecallerRequestNonce = trueClient.generateRequestNonce(); super.onResume(); } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if(trueClient!=null && trueClient.onActivityResult(requestCode, resultCode, data)) { return; } super.onActivityResult(requestCode, resultCode, data); } @Override public void onSuccesProfileShared(@NonNull TrueProfile trueProfile) { Toast.makeText(auth.this, trueProfile.firstName + " " + trueProfile.lastName, Toast.LENGTH_LONG).show(); } @Override public void onFailureProfileShared(@NonNull TrueError trueError) { Log.e("error code", trueError.getErrorType() + " "); } } 

3 Answers 3

13
+50

Here is the list of all of the TrueCaller error codes:

ERROR_TYPE_INTERNAL = 0; ERROR_TYPE_NETWORK = 1; ERROR_TYPE_USER_DENIED = 2; ERROR_TYPE_UNAUTHORIZED_PARTNER = 3; ERROR_TYPE_UNAUTHORIZED_USER = 4; ERROR_TYPE_TRUECALLER_CLOSED_UNEXPECTEDLY = 5; ERROR_TYPE_TRUESDK_TOO_OLD = 6; ERROR_TYPE_POSSIBLE_REQ_CODE_COLLISION = 7; ERROR_TYPE_RESPONSE_SIGNATURE_MISSMATCH = 8; ERROR_TYPE_REQUEST_NONCE_MISSMATCH = 9; 

These codes are static members of the TrueError class, so you could access them like so:

switch (trueError.getErrorType()) { case TrueError.ERROR_TYPE_INTERNAL: // do something break; case TrueError.ERROR_TYPE_NETWORK: // do something else break; // etc. } 

In your case the error you are getting is error code 3, ERROR_TYPE_UNAUTHORIZED_PARTNER. Have you made sure to get the partner key, and to add this line in your AndroidManifest.xml?

<meta-data android:name="com.truecaller.android.sdk.PartnerKey" android:value="YOUR_PARTNER_KEY_HERE"/> 
Sign up to request clarification or add additional context in comments.

6 Comments

yeah, the partner key I received from the Truecaller itself and already added in manifest.
In this case it is likely that the signatures do not match. Have you made sure to use the same signing key for the app as the one you submitted to Truecaller? Also, Android studio might sign your debug app with the default debug certificate instead of your own. You can take a look at this answer to fix that.
sorry, I was out of station. Lets say my project is 'abc', I generated a key for 'abc' as 'abc.jks' while creating a signed apk. I used the .jks file to generate the SHA1 fingerprint using : 'keytool -list -v -keystore abc.jks' in the key location folder. Provided same key to Truecaller and I was given a different Partner key. Still the same error : 3
I've tried same with Debug key as well in the first attempt .. still no luck :(
At this point I can't be sure of what's happening, but here's all the information Truecaller sends about your app to their servers (taken from decompiled Truecaller app): putString("PARTNERINFO_TRUESDK_VERSION", this.truesdkVersion); putString("PARTNERINFO_PARTNER_KEY", this.partnerKey); putString("PARTNERINFO_PACKAGE_NAME", this.packageName); putString("PARTNERINFO_APP_FINGERPRINT", this.appFingerprint); putString("PARTNERINFO_REQ_NONCE", this.reqNonce); If you can't fix with this you should probably contact Truecaller support.
|
7

Finally got it working with helps. Thanks to @Sayan for taking me one step closer and @qualverse to understanding the 'Error-Codes'.

Truecaller requires SHA1 from you and provide you back with PartnerKey. What I figured out is that it doesn't matter if your app is release or debug. If PartnerKey is generated with debug SHA1 key then you must build app with debug variant and if PartnerKey is generated with released SHA1 then build app with released variant.

Below screenshot will help in understanding the key type:

enter image description here

One can make entries for both variant on Truecaller dashboard to work on both variant simultaneously. Always make sure to signing the release variant properly.

2 Comments

I have added both SHA1 in portal but still facing same issue.
Yes , i also getting the same issues from a long time. Both the SHA-1 is added on true caller console. Have you any proper solution.
7

change your build variant debug to release and PartnerKey is generated with released SHA1 then build app. I have facing same problem , every time getting error code 3. Change debug to release solve my problem.

3 Comments

Just now tried with app-release.apk and still same error code 3
Thanks Sayan, I have it working now. Actually the problem was with the key .. I had my Partnerkey generated with the Debug SHA1 and was testing with the released apk.
sorry for delay comment .. forget to say about release SHA1 .... great to know finally your partner key working properly.Update my post also.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.