无法在Android中从LinkedIn获取公开个人资料网址(BufferedInputStream已关闭)

far*_*ath 6 android linkedin linkedin-j

我无法获取公开个人资料网址并从Android中的LinkedIn api获取或发布.我正在使用linkedin-j-android源码.我能够获得成功的accessstoken但是从这个线路调用时OnNewIntent.

编辑:我在我的应用程序中拥有互联网权限.所以这不会是个问题.

Person profile = client.getProfileForCurrentUser(EnumSet.of(ProfileField.PUBLIC_PROFILE_URL));
Run Code Online (Sandbox Code Playgroud)
 @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());
    }
Run Code Online (Sandbox Code Playgroud)

应用程序崩溃.以下是日志跟踪.

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)
Run Code Online (Sandbox Code Playgroud)

请帮我.提前致谢.

Nim*_*ary 2

此代码片段适合您吗:

   Person profile = client.getProfileForCurrentUser();
   Log.v("","PUBLIC_PROFILE_URL:" + profile.getPublicProfileUrl());
Run Code Online (Sandbox Code Playgroud)