问题描述
我正在尝试在我的个人应用之一上实施 Truecaller android-SDK 以进行登录/注册.我从 truecaller 收到合作伙伴密钥以在我的应用程序中实现它.在public void onFailureProfileShared()"中的trueError.getErrorType()"上按Autofill with truecaller"时发生错误返回错误代码3".我似乎找不到描述错误的方法.有人碰巧知道要修复此错误吗?
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?
我的实现:
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() + " ");
}
}
推荐答案
终于在帮助下开始工作了.感谢@Sayan 让我更近一步,感谢@qualverse 理解错误代码".
Finally got it working with helps. Thanks to @Sayan for taking me one step closer and @qualverse to understanding the 'Error-Codes'.
Truecaller 需要您提供 SHA1,并向您提供 PartnerKey.我发现您的应用是发布还是调试并不重要.如果 PartnerKey 是使用 debug SHA1 密钥生成的,那么您必须使用 调试变体 生成应用程序,如果 PartnerKey 是使用 已发布的 SHA1 生成的,那么您必须使用 生成应用程序强>已发布变体.
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:
可以在 Truecaller 仪表板上为这两个变体输入条目,以同时处理这两个变体.始终确保正确签署发布变体.
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.
这篇关于Truecaller android sdk 错误代码 3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!