Truecaller android sdk Error Code 3

VipiN Negi :

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() + " ");
}
}
VipiN Negi :

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.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=430752&siteId=1