Step by Step Developers Guide to Integrate LinkedIn with an Android Application is an article sent to you by the InApps editorial team. Hope readers will have more useful knowledge at www.inapps.net


You are viewing the article: Step by Step Developers Guide to Integrate LinkedIn with an Android Application

LinkedIn- we know it as the world’s largest professional network that enables users to share an update about their professional activities. Be it changing a job or completion of a project, LinkedIn has remained a preferred social media platform for professionals.

The data on LinkedIn is largely based on corporate life and business communities have embraced this platform for getting the reference of individuals. Its growing popularity worldwide is one of the major reasons why mobile app developers tend to integrate it with Android applications.

Integration of LinkedIn with existing Android apps can offer a plethora of advantages. One of them is users can share various information about their career without exiting from the app. Let’s go through a step-by-step process of integrating LinkedIn with Android apps.

Overview of Android SDK

• The Android SDK reduces your app’s time to market (TTM) by providing out-of-box support for LinkedIn natively inside your Android applications.
• The Mobile SDK for Android requires the support of the official LinkedIn Android application for the smooth and bug-free app development process using the LinkedIn APK file
• The minimum supported version is Android 4.4.2 (API 19).

Necessary SDK Features

Single Sign-on (SSO) authentication, in conjunction with the LinkedIn mobile app.
A convenient wrapper for making authenticated calls to LinkedIn’s REST APIs.
“Deep-linking” to additional member data in the LinkedIn mobile app.
Sample application that demonstrates best-practice implementations of all of the SDK’s features.

Read More:   Update Impact of Blockchain Technology on Mobile Healthcare

Here are key steps to follow for integrating LinkedIn into an Android application.

Step 1- Establish Development Environment
Let’s start from scratch. You need to install IDE for integrating LinkedIn into the app. One of the most popular choices in the IDE for such integration is Eclipse along with different Android developer tools. Other IDE options are Google’s Android Studio and JetBrains IntelliJ IDEA.

After installing the IDE, you need to install Android SDK with in-built tools.

Step 2- Create Application
-To Integrate LinkedIn in your Android mobile application, you need to create a new application using LinkedIn Developer’s Account
https://www.linkedin.com/developer/apps

Step 3- Set the Application Permission
You have to set the Default Application Permissions and to do that you have to select check box “r_basicprofile” and “r_emailaddress” and click on the “update” button to set the permission.

Step 4- Download Mobile LinkedIn SDK
Go to https://developer.linkedin.com/docs/android-sdk and download an Android SDK

Step 5- Generate Hash Key
-Generate a hash key and integrate your app with the LinkedIn account
-Go to https://www.linkedin.com/developer/apps
-Select your application name and click the ‘Mobile’ tab
-Add the package name and generated a hash key in your LinkedIn Application.
-This hash key will authenticate your mobile application.
Here are Login and Logout processes.

Login

private static final String topCardUrl = “https://” + host + “/v1/people/~:(first-name,last-name,email-address,formatted-name,phone-numbers,public-profile-url,picture-url,picture-urls::(original))”;
private static Scope buildScope() {
return Scope.build(Scope.R_BASICPROFILE, Scope.R_EMAILADDRESS, Scope.W_SHARE);
}
public void loginLinkedin() {
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) {
}
@Override
public void onApiError(LIApiError error) {
}
});
}
@Override
public void onAuthError(LIAuthError error) {
}
}, true);

Logout

LISessionManager.getInstance(getApplicationContext()).clearSession();
Check Login
private boolean isLogin(){
LISessionManager sessionManager = LISessionManager.getInstance(getApplicationContext());
LISession session = sessionManager.getSession();
boolean accessTokenValid = session.isValid();
return accessTokenValid;
}
Share Message
private static final String shareUrl = “https://” + host + “/v1/people/~/shares”;
public void shareMessage() {
APIHelper apiHelper = APIHelper.getInstance(getApplicationContext());
apiHelper.postRequest(MainActivity.this, shareUrl, buildShareMessage(“Hello World”, “Hello Title”, “Hello Descriptions”, “http://ankitthakkar90.blogspot.in/”, “http://1.bp.blogspot.com/-qffW4zPyThI/VkCSLongZbI/AAAAAAAAC88/oGxWnHRwzBk/s320/10333099_1408666882743423_2079696723_n.png”), new ApiListener() {
@Override
public void onApiSuccess(ApiResponse apiResponse) {
}
@Override
public void onApiError(LIApiError error) {
}
});
}
public String buildShareMessage(String comment,String title,String descriptions,String linkUrl,String imageUrl ){
String shareJsonText = “{ n” +
” “comment”:”” + comment + “”,” +
” “visibility”:{ ” +
” “code”:”anyone”” +
” },” +
” “content”:{ ” +
” “title”:””+title+””,” +
” “description”:””+descriptions+””,” +
” “submitted-url”:””+linkUrl+””,” +
” “submitted-image-url”:””+imageUrl+””” +
” }” +
“}”;
return shareJsonText;
}

Read More:   Update 8 Valuable Tips to Master Best Code Practices in Node.JS

Open Current User Profile

public void openUserProfile(){
DeepLinkHelper deepLinkHelper = DeepLinkHelper.getInstance();
deepLinkHelper.openCurrentProfile(MainActivity.this, new DeepLinkListener() {
@Override
public void onDeepLinkSuccess() {
}
@Override
public void onDeepLinkError(LIDeepLinkError error) {
}
});
}

Best Practices

Posting on member’s behalf: You need to assure the app users that you will not post or send mail on their behalf without their consent, and give them the option to edit content before posting or not sharing content.

Permission Request: You should inform users about all the permissions you are requesting and how you are going to use their data. LinkedIn does not support incremental permission requests, so all permissions must be granted during the authorization step.

Authentication:
• Remind the user that they are logged into your application by displaying their name, portrait, and/or account settings
• Avoid multiple log-in prompts
• Cache the user’s access token after they grant your application and do not bring the user through the authentication flow again unless they log out or the access token expires or is otherwise invalid
• You should allow the user to log out, and when they log out you should destroy the access token you had been granted
Canceling in-progress requests: During your application’s workflow, you may wish to cancel any in-progress API requests. This is done by calling APIHelper.cancelCalls() method.

Using ProGaurd with your application: If you wish to use ProGuard on the release build of your mobile application, you will need to add the following lines to your project’s proguard-project.txt file to preserve information required for the SDK to function properly:

Proguard configuration- Keep class com.linkedin.** { *; } , keep attributes Signature

Mobile access tokens

It is important to note that access tokens that are acquired via the Mobile SDK are only usable with the Mobile SDK, and cannot be used to make server-side REST API calls.

Partnership Program

All other APIs (e.g. Connections, Groups, People Search, Invitation, Job Search, etc.) will require developers to become a member of one of our partnership programs.

Read More:   Update Chatbots for E-Commerce That Drive Business and Build Brands

Partnering with LinkedIn provides you with additional API functionality & data access, increased call limits & dedicated support.
Applications are only accepted when we feel that they’re providing value to members, developers, and LinkedIn.

https://developer.linkedin.com/partner-programs

References:
https://developer.linkedin.com/docs/android-sdk
https://developer.linkedin.com/docs/android-sdk-auth
https://developer.linkedin.com/downloads#androidsdk
https://www.numetriclabz.com/android-linkedin-integration-login-tutorial/
https://developer.linkedin.com/docs/oauth2
https://developer.linkedin.com/partner-programs/apply
https://developer.linkedin.com/support/developer-program-transition
You can Download source code of this example from Github.




Follow this to make sure you’ve got Step by Step Developers Guide to Integrate LinkedIn with an Android Application. Save and share with those around you these extras.
To learn more about ECOMMERCE DEVELOPMENT

Contact us:
www.inapps.net

Rate this post
As a Senior Tech Enthusiast, I bring a decade of experience to the realm of tech writing, blending deep industry knowledge with a passion for storytelling. With expertise in software development to emerging tech trends like AI and IoT—my articles not only inform but also inspire. My journey in tech writing has been marked by a commitment to accuracy, clarity, and engaging storytelling, making me a trusted voice in the tech community.

Let’s create the next big thing together!

Coming together is a beginning. Keeping together is progress. Working together is success.

Let’s talk

Get a custom Proposal

Please fill in your information and your need to get a suitable solution.

    You need to enter your email to download

      [cf7sr-simple-recaptcha]

      Success. Downloading...