Vishnu V S Vishnu V S - 1 month ago 11
Android Question

How to fetch Contact number using linkedin mobile sdk

private static final String host = "api.linkedin.com";
private static final String PROTECTED_URL_GET_CURRENT_USER_PROFILE = "https://api.linkedin.com/v1/people/~:(id,first-name,last-name,email-address,picture-url,industry)";


How do I to add a field to get contact number?

Is there any other method to get details from Linked-in?

Answer

User the following urls to fetch LinkedIn data.

private static final String HOST = "api.linkedin.com";
private static final String FETCH_BASIC_INFO = "https://" + host + "/v1/people/~:(id,first-name,last-name,headline,location,industry)";
private static final String FETCH_CONTACT = "https://" + host + "/v1/people/~:(num-connections,email-address,phone-numbers,main-address)";
private static final String FETCH_PROFILE_PIC = "https://" + host + "/v1/people/~:(picture-urls::(original))";
private static final String SHARE_URL = "https://" + host + "/v1/people/~/shares";

Don't forget to set permission for accessing above info at both mobile app as well as while registering app in LinkedIn

  private static Scope buildScope() {
    return Scope.build(Scope.R_BASICPROFILE, Scope.W_SHARE, Scope.R_EMAILADDRESS, Scope.R_CONTACTINFO);
}
Comments