我只是按照「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