Social Media Integration (LinkedIn Login)
Hello and welcome back guys. So as we promised earlier that we will be back soon with another tutorial of a social media platform login integration in an android app. So here we are and today we are going to do the LinkedIn login in Android .
So let’s begin.
Some of the things that you should do in advance before starting the integration process.
1.Download the LinkedIn SDK for android here:- https://developer.linkedin.com/docs/android-sdk
The Mobile SDK for Android requires the official LinkedIn Android application is also installed to support the SDK’s capabilities.Due to Google Play store limitations on emulated Android devices, you will very likely want to acquire the LinkedIn APK file and manually install on virtual devices it for a smoother development and debugging experience.So to run it on Emulator install the APK from this url first:- https://developer.linkedin.com/downloads#apk
2. The minimum required Android SDK version is Android 4.4.2 (API 19).
3.Now go to https://www.linkedin.com/start/join and login with your LinkedIn account or if you don’t have one make a new one.
4. Then create a new application after you log into your account and fill out your android package name and key hashes(how to obtain them is explained in the part I of this tutorial).
There are two types of key hashes: debug (i.e. development) and release (i.e. production).
- Debug keys are required for LinkedIn to verify the authenticity of your application while it interacts with our APIs during your development cycle.
- A release key is required because all Android applications must be signed with one before they can be uploaded to the Play store for distribution.
Now you are almost done with the pre- procedure things.Now let’s start the integration procedure.
5. Now import the LinkedIn SDK into your android project for doing so go to File>New>Import Module
6.Now add a button or ImageButton whomever you find suitable for your app.
7. Now in the Button’s onClickListener which must be in the onCreate() of the activity from which you are launching the event, add the following code:-
8.Now add the onActivityResult() to the activity class and paste the following code:-
9.Now go to your app gradle and add in dependencies:- compile project(‘:linkedin-sdk’).
10.Now sync the project with gradle files(gradle built). You will most probably find a multipleDexFile error and to remove that go to you settings.gradle and remove the ‘sampleapp’ and ‘eventsapp’ from that gradle file if they are present but make sure that
11. Now run the gradle sync again and it will compile. And now you are good to go with your LinkedIn authentication process and you can change the requested user profiles from the application that you made at the https://developer.linkedin.com/ in the beginning.
So that’s it for this tutorial. Please let us know if you are getting an error while implementing this, we would be glad to hear it from you guys. So now it’s the end of this part we would be back again with the next part of this series with another social media platform . Until then keep coding…keep discovering.