我只是按照“https://developer.linkedin.com/docs/android-sdk”在我的应用程序中集成链接的sdk。 ,我在我的应用程序都做过这样的步骤,无法在安卓工作室版本的apk中使用linkedin登录?
- 下载LinkedIn库移动
- 导入它在我的应用程序作为库
- 获取密钥哈希码
- 创建LinkedIn开发者内部的应用控制台
- 配置包的名称&包哈希
越看越后东西在我的应用程序中正常工作。这意味着我可以从linkedin中访问配置文件详细信息(可调试案例)。但问题是我无法登录,当我建立发布的apk。
加入release key
inside linkedin开发人员的应用程序。适用于Mac,我只是用下面的命令来获得释放终端关键,
keytool -exportcert -keystore MY_RELEASE_KEY_PATH -alias MY_RELEASE_KEY_ALIAS | openssl sha1 -binary | openssl base64
这里是我的Activity
代码:
public void login(View view) {
LISessionManager.getInstance(getApplicationContext())
.init(this, buildScope(), new AuthListener() {
@Override
public void onAuthSuccess() {
APIHelper apiHelper = APIHelper.getInstance(getApplicationContext());
apiHelper.getRequest(MainActivity.this, topCardUrl, new ApiListener() {
@Override
public void onApiSuccess(ApiResponse s) {
Log.e(TAG, "Profile json" + s.getResponseDataAsJson());
Log.e(TAG, "Profile String" + s.getResponseDataAsString());
try {
Log.e(TAG, "Profile emailAddress" + s.getResponseDataAsJson().get("emailAddress").toString());
Log.e(TAG, "Profile formattedName" + s.getResponseDataAsJson().get("formattedName").toString());
txtFirstName.setText(s.getResponseDataAsJson().get("emailAddress").toString());
txtLastName.setText(s.getResponseDataAsJson().get("formattedName").toString());
Picasso.with(MainActivity.this).load(s.getResponseDataAsJson().getString("pictureUrl"))
.into(imgProfilePic);
}catch (Exception e){
}
}
@Override
public void onApiError(LIApiError error) {
//((TextView) findViewById(R.id.response)).setText(error.toString()); Toast.makeText(getApplicationContext(), "Profile failed " + error.toString(),
Toast.LENGTH_LONG).show();
}
});
}
@Override
public void onAuthError(LIAuthError error) {
Toast.makeText(getApplicationContext(), "failed " + error.toString(),
Toast.LENGTH_LONG).show();
}
}, true);
}
private static Scope buildScope() {
return Scope.build(Scope.R_BASICPROFILE, Scope.R_EMAILADDRESS);
}
@Override
protected void onActivityResult(int requestCode,
int resultCode, Intent data) {
LISessionManager.getInstance(getApplicationContext())
.onActivityResult(this,
requestCode, resultCode, data);
}
每次我得到下面的错误,而点击我的应用程序signin with linkedin
按钮。
Error={
"errorCode": "UNKNOWN_ERROR"
}
我也面临同样的问题。如果您解决了此问题,请与我们分享 – user2881604