I just followed “https://developer.linkedin.com/docs/android-sdk” for integrating linked sdk in my app. the steps that i have done in my app such as,
- Download linkedin library for mobile
- Import it in my app as library
- Get Key hash code
- Create a application inside linkedin developer console
- Configured package name & Package hash
After then everything is working fine in my app. that means i am able to access profile details from linkedin(debuggable case). but the problem is i am not able to login when i build the released apk.
Added release key inside linkedin developer app. for mac i just used the below command to get release key in terminal,
keytool -exportcert -keystore MY_RELEASE_KEY_PATH -alias MY_RELEASE_KEY_ALIAS | openssl sha1 -binary | openssl base64
Here is my Activity code:
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);
}
Everytime i am getting the below error while click on signin with linkedinbutton in my app.
Error={
"errorCode": "UNKNOWN_ERROR"
}