How about everyone I am starting to integrate a app , with Linkedin and I was in it ..
public static final String HOST = "api.linkedin.com";
public static final String TOPCARDURL = "https://" + HOST
+ "/v1/people/~:(id,first-name,last-name,public-profile-url,picture-url,email-address,picture-urls::(original))";
@OnClick(R.id.btnLinkedin)
public void iniciarSesionLINKEDIN() {
LISessionManager.getInstance(getApplicationContext()).init(this, buildScope(), new AuthListener() {
@Override
public void onAuthSuccess() {
getPerfilLinkedin();
}
@Override
public void onAuthError(LIAuthError error) {
Log.d(TAG, error.toString());
}
}, true);
}
private void getPerfilLinkedin() {
APIHelper apiHelper = APIHelper.getInstance(getApplicationContext());
apiHelper.getRequest(this, TOPCARDURL, new ApiListener() {
@Override
public void onApiSuccess(ApiResponse s) {
try {
JSONObject object = s.getResponseDataAsJson();
Log.d(TAG, object.get("emailAddress").toString());
Log.d(TAG, object.get("formattedName").toString());
} catch (Exception e) {
Log.d(TAG, e.toString());
}
}
@Override
public void onApiError(LIApiError error) {
Log.d(TAG, "getPerfilLinkedin"+ error.toString());
}
});
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
callbackManager.onActivityResult(requestCode, resultCode, data);
LISessionManager.getInstance(getApplicationContext()).onActivityResult(this, requestCode, resultCode, data);
}
I am able to open the screen of Linkedin but it closes immediately, the error occurs that when doing a session iniciarSesionLINKEDIN()
, it votes me in front of onAuthError()
with the following message
11-10 15:33:15.241 18900-18900/application.ucweb.proyectoecoinca D/IniciarSesionActivity: {
"errorCode": "INVALID_REQUEST",
"errorMessage": "either bundle id or package name \/ hash are invalid, unknown, malformed" }
If someone has already had experience integrating Linkedin please can you give me a hand. Thanks.