Description
A lightweight android library to implement Login with LinkedIn in your Android app, that supports both Activities and Fragments.
LinkedIn-SDK-Android alternatives and similar packages
Based on the "SDK" category.
Alternatively, view LinkedIn-SDK-Android alternatives based on common mentions on social networks and blogs.
-
card.io-Android-SDK
card.io provides fast, easy credit card scanning in mobile apps -
Android-ReactiveLocation
Small library that wraps Google Play Service API in brilliant RxJava Observables reducing boilerplate to minimum. -
aws-sdk-android
Official mirror of the AWS SDK for Android. -
PayPal-Android-SDK
Accept PayPal and credit cards in your Android app -
LandscapeVideoCamera
Powerful custom Android Camera with granular control over the video quality and filesize, restricting recordings to landscape only. -
android-checkout
Library for Android In-App Billing (Version 3) -
countly-sdk-android
Countly Mobile Analytics - Android SDK -
Applozic-Android-Chat-Messaging-SDK
Android Chat and Messaging SDK for adding real time chat and in-app messaging into your android application -
WeatherLib
Android Weather Library: android weather lib to develop weather based app fast and easily -
evernote-sdk-android
Evernote SDK for Android -
ANE-Facebook
Air Native Extension (iOS and Android) for the Facebook mobile SDK -
socialauth-android
SocialAuth repository which contains socialauth android version and samples -
poly-picker
Android library project for providing multiple image selection from the device. -
android-donations-lib
Donations Library for Android. Supports Google Play Store, Flattr, PayPal, and Bitcoin -
MultipleImageSelect
An android library that allows selection of multiple images from gallery. -
Office-365-SDK-for-Android
Office 365 SDK for Android Preview by Microsoft Open Technologies, Inc. -
Clusterkraf
A clustering library for the Google Maps Android API v2. -
Chat21 SDK Documentation
java android chat firebase sdk iOS realtime Ionic messaging emoji -
android-simpl3r
Amazon S3 multipart file upload for Android, made simple -
Android-ShareEverywhere
This project is the tribute to my favorite Android Widget: the Share button. Share ALL THE THINGS! -
Liquid-Android-SDK
Liquid - Identify behaviours through Analytics and react with real-time Personalization. -
Horoscope-API
Horoscope API for java/android to get the horoscope according to the sunsign -
Smartlook Android SDK
Qualitative Analytics for Android Apps -
Twiiter Helper
A twitter helper library that makes Twitter integration very easy and painless.
Scout APM - Leading-edge performance monitoring starting at $39/month
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest. Visit our partner's website for more details.
Do you think we are missing an alternative of LinkedIn-SDK-Android or a related project?
README
LinkedIn-SDK-Android
A lightweight android library to implement Login with LinkedIn in your Android app, that supports both Activities and Fragments.
Inspired by shantanu-deshmukh/LinkedIn-SDK-Android
Table of contents
- Targeted use cases
- Main changes over the original
- SDK Structure
- Why this UnOfficial SDK?
- Adding the SDK to your Project
- Usage
- Security
- Contributing
Targeted use cases
This SDK was designed to be used to authenticate with LinkedIn mainly for two use cases:
- If you want only to retrieve a user's access token.
- For example to be sent the a back end server via your own APIs for further processing and data fetching.
- If you want to get the user's lite profile.
- For simpler login process and to get his user name and profile picture.
You can choose which one you best suits you, simply using the setAccessTokenRetrievalOnlyRequest(accessTokenRetrievalOnlyRequest: Boolean)
method in LinkedInBuilder
object.
For example:
LinkedInFromFragmentBuilder.getInstance(MainActivity.this)
.setClientID(clientID)
.setAccessTokenRetrievalOnlyRequest(true)
.setClientSecret(clientSecret)
.setRedirectURI(redirectUrl)
.authenticate(LINKEDIN_REQUEST);
will only try to retrieve user access token while the following the try to get the lite profile as well
LinkedInFromFragmentBuilder.getInstance(MainActivity.this)
.setClientID(clientID)
.setAccessTokenRetrievalOnlyRequest(false)
.setClientSecret(clientSecret)
.setRedirectURI(redirectUrl)
.authenticate(LINKEDIN_REQUEST);
This flag defaults to false for backward compatibility reasons.
Main changes over the original
- [x] Add support for usage from fragments.
- [x] Allow for access token only request.
- [x] Kotlin-lize the SDK since now Kotlin is the main dev language for Android.
- [ ] Better error handling.
SDK Structure
The SDK follows the clean architecture principles, so it's mainly divided into use cases, data, presentation(MVVM) and ui layers. Each has its own package, with manual dependency injection system to inject them when needed.
Why this UnOfficial SDK?
- Existing SDKs have been discontinued.
- Official docs on developer.linkedin.com are outdated.
Adding the SDK to your Project
Just add the dependency to your app level build.gradle
file
dependencies {
implementation 'com.AbdAllahAbdElFattah13:linkedinsdk:1.2.0'
}
If you are getting
Failed to resolve
ERROR, make sure that Jcenter repository is added to your project levelbuild.gradle
file. This is done by default in recent versions of Android Studio.
Usage
Authenticating
- Add internet permission to your
AndroidManifest.xml
file if it's not already added.
<uses-permission android:name="android.permission.INTERNET" />
- Initiate Login Request. (You might want to do this on click of a login button)
- From within fragments:
Kotlin LinkedInFromFragmentBuilder.getInstance(MainActivity.this) .setClientID("<YOUR_CLIENT_ID_HERE>") .setClientSecret("<YOUR_CLIENT_SECRET_HERE>") .setRedirectURI("<YOUR_REDIRECT_URL_HERE>") .authenticate(LINKEDIN_REQUEST_CODE);
- From within fragments:
* From within activities:
```Kotlin
LinkedInFromActivityBuilder.getInstance(MainActivity.this)
.setClientID(Œ"<YOUR_CLIENT_ID_HERE>")
.setClientSecret("<YOUR_CLIENT_SECRET_HERE>")
.setRedirectURI("<YOUR_REDIRECT_URL_HERE>")
.authenticate(LINKEDIN_REQUEST_CODE);
```
You can download the official Sign In with LinkedIn button images from here
- Handling Result: the sdk returns
LinkedInUser
object which contains the result data.
@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) {
//Successfully signed in
LinkedInUser user = data.getParcelableExtra("social_login");
//acessing user info
Log.i("LinkedInLogin", user.getFirstName());
} else {
if (data.getIntExtra("err_code", 0) == LinkedInBuilder.ERROR_USER_DENIED) {
//Handle : user denied access to account
} else if (data.getIntExtra("err_code", 0) == LinkedInBuilder.ERROR_FAILED) {
//Handle : Error in API : see logcat output for details
Log.e("LINKEDIN ERROR", data.getStringExtra("err_message"));
}
}
}
}
LinkedInUser Class
Return | Method | Description |
---|---|---|
String | getId() |
Returns LinkedIn user ID |
String | getEmail() |
Returns users email (May return 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 that can be used to retrive data later. You might want to store it for later use. |
long | getAccessTokenExpiry() |
Expiry timestamp of the access token in Millisecond. |
Security
To protect against CSRF during authorization, the sdk uses a 16 character token by default. If you want to use your own CSRF token, then use the setState
method of the LinkedInBuilder
class.
From within fragments:
LinkedInFromFragmentBuilder.getInstance(MainActivity.this) .setClientID("<YOUR_CLIENT_ID_HERE>") .setClientSecret("<YOUR_CLIENT_SECRET_HERE>") .setRedirectURI("<YOUR_REDIRECT_URL_HERE>") .setState("<YOUR_CSRF_TOKEN_HERE>") .authenticate(LINKEDIN_REQUEST_CODE);
From within activities:
LinkedInFromActivityBuilder.getInstance(MainActivity.this) .setClientID("<YOUR_CLIENT_ID_HERE>") .setClientSecret("<YOUR_CLIENT_SECRET_HERE>") .setRedirectURI("<YOUR_REDIRECT_URL_HERE>") .setState("<YOUR_CSRF_TOKEN_HERE>") .authenticate(LINKEDIN_REQUEST_CODE);
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.