Android LinkedIn Integration: Android - LeaVe my baThRoom at-least !
LinkedIn is a business and employment-oriented social networking service that operates via websites and mobile apps. It is mainly used for professional networking, including employers posting jobs and job seekers posting their curriculum vitae. LinkedIn allows members (both workers and employers) to create profiles and "connections" to each other in an online social network which may represent real-world professional relationships. It presents curriculum vitae of the individual which can be browsed by recruiters.
Android allow applications to connect to LinkedIn and share data or any kind of updates on LinkedIn.
Following are the ways through which you can integrate LinkedIn in application
Android allow applications to connect to LinkedIn and share data or any kind of updates on LinkedIn.
Following are the ways through which you can integrate LinkedIn in application
- LinkedIn SDK(Scribe)
- Intent Share
The mobile SDK for Android increases your app's time to market by providing out-of-box support for LinkedIn natively inside your Android applications. This allows you to boost your sign in conversion rates and provides you more time to work on the things that matter.
The SDK provides:
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.
Follow steps to integrate LinkedIn SDK
Creating a new app in LinkedIn Developer account
Create a new LinkedIn application at https://www.linkedin.com/developer/apps. Click on Create new Application and follow the setup.
Fill following form
you will get Application ID for your Application
Create new Android Project
Open AndroidManifest.xml file and include the following code given below:
<uses-permission android:name="android.permission.INTERNET" />
Download Mobile LinkedIn SDK
Go to https://developer.linkedin.com/docs/android-sdk and download a Mobile SDK for Android.
Unzip the file and add LinkedIn-sdk folder in your project.
Add Mobile LinkedIn SDK in project
Open setting.gradle file in your project and include linkedin-sdk folder in your project.
include ':app',':linkedin-sdk
Adding library in depencencies
Add the following code in the file’s (/app/build.gradle file) dependencies to compile linkedin-sdk
compile project(':linkedin-sdk')
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'de.hdodenhof:circleimageview:1.3.0'
Synchronize your project
Generate hash Key
We need to generate a hash key. This generated Hash key will integrate your app with LinkedIn account.
Adding hash key in your LinkedIn Developer account
Go to https://www.linkedin.com/developer/apps select your application name and click the Mobile tab. Add the package name and generated hash key in your LinkedIn Application. This hash key will authenticate your mobile application.
Once everything is complete, you can run the Linkedin sample application
2. Intent Share
An android share intent allow your app to share contents such as URL or text and Image to other apps installed in your Android device like Facebook, Twitter, Messaging, Instagram, whatsapp, etc.
Android provides intent library to share data between activities and applications. In order to use it as share intent , we have to specify the type of the share intent to ACTION_SEND. Its syntax is given belowIntent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND);
Next thing you need to is to define the type of data to pass , and then pass the data. Its syntax is given below shareIntent.setType("text/plain");
shareIntent.putExtra(Intent.EXTRA_TEXT, " From Suven Consultency");
startActivity(Intent.createChooser(shareIntent, "Hello!!!!"));
Example
here is an example to share data on Linkedin using intent share.
- You will use Android studio to create an Android application under a package net.suven.android.android_linkedinintegration.
- Modify src/MainActivity.java file to add necessary code.
- Modify the res/layout/activity_main to add respective XML components.
- Run the application and choose a running android device and install the application on it and verify the results.
MainActivity.java
activity_main
Following is the output of application.
Click on share button. you will see list of share provider
Comments
Post a Comment