我已经在android工作室完成了link-in的集成,但是我遇到了一个很难的错误。如果有人知道请告诉我。我被困在这里。
确切的错误行是getAuthorizationUrl();方法已抛出为OauthLinkedin -----> com.google.code.linkedinapi.client.oauth.LinkedInOAuthServiceException:oauth.signpost.exception.OAuthCommunicationException:与服务提供商的通信失败:https://api.linkedin.com/uas/oauth/requestToken
if (android.os.Build.VERSION.SDK_INT > 9) {
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
StrictMode.setThreadPolicy(policy);
}
@OnClick(R.id.createAccForLikedin)
public void createAccForLikedinClick(Button button) {
progress.setMessage("Please Wait while we Redirect...");
progress.setCanceledOnTouchOutside(false);
progress.show();
getLinkedinLogin();
}
public void getLinkedinLogin() {
oAuthService = LinkedInOAuthServiceFactory.getInstance()
.createLinkedInOAuthService(Constants.CONSUMER_KEY,
Constants.CONSUMER_SECRET);
System.out.println("oAuthService : " + oAuthService);
factory = LinkedInApiClientFactory.newInstance(
Constants.CONSUMER_KEY, Constants.CONSUMER_SECRET);
liToken = oAuthService
.getOAuthRequestToken(Constants.OAUTH_CALLBACK_URL);
Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse(liToken
.getAuthorizationUrl()));
startActivity(i);
}
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
try {
linkedInImport(intent);
} catch (NullPointerException e) {
e.printStackTrace();
}
}