Failed to get public url profile from LinkedIn on Android (BufferedInputStream closed)

I cannot get the URL of a public profile and receive or send a message from the LinkedIn api application in Android. I am using the source linkedin-j-android. I can get a successful accesstoken, but when calling this line from OnNewIntent .

Edited: I have internet permission in my application. So this is not a problem.

 Person profile = client.getProfileForCurrentUser(EnumSet.of(ProfileField.PUBLIC_PROFILE_URL)); 

  @Override protected void onNewIntent(Intent intent) { String verifier = intent.getData().getQueryParameter("oauth_verifier"); LinkedInAccessToken accessToken = oAuthService.getOAuthAccessToken(liToken, verifier); client = factory.createLinkedInApiClient(accessToken); Person profile = client.getProfileForCurrentUser(EnumSet.of(ProfileField.PUBLIC_PROFILE_URL)); Log.v("","PUBLIC_PROFILE_URL:" + profile.getPublicProfileUrl()); } 

The application crashes. The following is the path of the journal.

 FATAL EXCEPTION: main com.google.code.linkedinapi.client.LinkedInApiClientException: java.io.IOException: BufferedInputStream is closed at com.google.code.linkedinapi.client.impl.LinkedInApiXppClient.unmarshallObject(LinkedInApiXppClient.java:167) at com.google.code.linkedinapi.client.impl.BaseLinkedInApiClient.readResponse(BaseLinkedInApiClient.java:3710) at com.google.code.linkedinapi.client.impl.BaseLinkedInApiClient.callApiMethod(BaseLinkedInApiClient.java:3777) at com.google.code.linkedinapi.client.impl.BaseLinkedInApiClient.callApiMethod(BaseLinkedInApiClient.java:3725) at com.google.code.linkedinapi.client.impl.BaseLinkedInApiClient.getProfileForCurrentUser(BaseLinkedInApiClient.java:1122) 

Please help me. Thanks in advance.

+6
source share
2 answers

this piece of code works for you:

  Person profile = client.getProfileForCurrentUser(); Log.v("","PUBLIC_PROFILE_URL:" + profile.getPublicProfileUrl()); 
+2
source

I answer my question because it may help some people. The code was right from my end, the problem was intent-filter . android:scheme and android:host do not match OAUTH_CALLBACK_URL. If you change this, the problem is resolved.

0
source

All Articles