Portfolio

LinkedIn SDK for Android
Lightweight Android Library for LinkedIn Authentication
About the Project
A lightweight Android library to implement Login with LinkedIn in your Android app. This unofficial SDK was created to address the discontinuation of existing LinkedIn SDKs and provide developers with a modern, easy-to-use solution.
Easy Integration
Simple setup with just a few lines of code
CSRF Protection
Built-in security against cross-site request forgery
Modern APIs
Uses current LinkedIn API endpoints
Lightweight
Minimal dependencies and small footprint
Why This SDK?
Discontinued SDKs
Existing LinkedIn SDKs have been discontinued, leaving developers without a reliable solution.
Outdated Documentation
Official LinkedIn documentation was outdated and didn't reflect current API changes.
API Issues
New LinkedIn APIs return JSON with special characters that break standard parsers.
Installation
Method 1: JCenter
dependencies {
implementation 'com.shantanudeshmukh:linkedinsdk:1.0.0'
}
Method 2: Jitpack
dependencies {
implementation 'com.github.shantanu-deshmukh:LinkedIn-SDK-Android:1:0'
}
Usage
Add Internet Permission
<uses-permission android:name="android.permission.INTERNET" />
Initiate Login
LinkedInBuilder.getInstance(MainActivity.this)
.setClientID("<YOUR_CLIENT_ID_HERE>")
.setClientSecret("<YOUR_CLIENT_SECRET_HERE>")
.setRedirectURI("<YOUR_REDIRECT_URL_HERE>")
.authenticate(LINKEDIN_REQUEST_CODE);
Handle Result
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == LINKEDIN_REQUEST_CODE && data != null) {
if (resultCode == RESULT_OK) {
LinkedInUser user = data.getParcelableExtra("social_login");
Log.i("LinkedInLogin", user.getFirstName());
} else {
// Handle errors
}
}
}
LinkedInUser Class
Return Type | Method | Description |
---|---|---|
String | getId() | Returns LinkedIn user ID |
String | getEmail() | Returns user's email (may be null) |
String | getFirstName() | Returns first name of the user |
String | getLastName() | Returns last name of the user |
String | getProfileUrl() | Returns profile URL of the user |
String | getAccessToken() | Returns access token for future API calls |
long | getAccessTokenExpiry() | Returns expiry timestamp of the access token |