In a previous post, I have explained how to access the Linkedin API’s using Scribe. But luckily Linkedin have introduced their Mobile SDK for Android recently. This will save lot of times for developers and hope in the future will have lot of functions over the SDK.
In this post I’m going to give some hints and important steps to integrate Linkedin SDK for existing linkedin integrated(Using Scribe) application. When using Scribe for OAuth
authentication, linkein returned us an AccessToken and we saved that in shared preferences for future use. With the new SDK we can use the previously saved AccessToken to access linkein API’s without creating new token. I have added that example in SDKIntergrationActivity.java
class and it’s being commented. You can refer this project and previous project in Github.(Find the below code snippet in SDKIntergrationActivity.java
)
|
|
There are few important points that should keep in mind while integrating new SDK.
- Keep different keystore files for different build types. Specially authorization will fail if we use debug.keystore for release build type. It will give the below error for authentication fail.
|
|
- Generate the
KEY HASH
and add thePACKAGE NAME
in to https://www.linkedin.com/secure/developer > Application Details > Android Package Names and Hashes. The format of the content as below and one application can support multiple packages and different build types. EachPACKAGE NAME
andKEY HASH
should start in a new line.
|
|
Linkedin SDK is currently using the volley library for network operations. I have faced a limitation with volley implementation, where I tried to get User Connections list and it returned me SSL handshake exception. Find more info in here.
|
|
To Overcome this exception I had to customize the volley library, by setting the setSSLSocketFactory
in HttpsURLConnection
class. You can find the changes in com.android.volley.toolbox.Volley
class line 72.
I have uploaded source to Github.