我正在将 LinkedIn 集成到我的应用程序中我现在有访问令牌我想获取经过身份验证的用户的所有更新提要,但无法弄清楚。我正在使用 Linked-in-J 库,请帮我解决这个问题,下面是我用来验证和获取用户名的代码。谢谢...
private void linkedInLogin() {
ProgressDialog progressDialog = new ProgressDialog(
LinkedInSampleActivity.this);// .show(LinkedInSampleActivity.this,
// null, "Loadong...");
LinkedinDialog d = new LinkedinDialog(LinkedInSampleActivity.this,
progressDialog);
d.show();
// set call back listener to get oauth_verifier value
d.setVerifierListener(new OnVerifyListener() {
@Override
public void onVerify(String verifier) {
try {
Log.i("LinkedinSample", "verifier: " + verifier);
LinkedInAccessToken accessToken = LinkedinDialog.oAuthService
.getOAuthAccessToken(LinkedinDialog.liToken,
verifier);
LinkedInApiClient client = LinkedinDialog.factory
.createLinkedInApiClient(accessToken);
Person p = client.getProfileForCurrentUser();
// Person pn=(Person) client.getUserUpdates();
System.out.println("My Status= " + p.getCurrentShare());
System.out.println("Get Updates= " + p.getFirstName());
// p.getCurrentShare()
CredentialStore credentialStore = new SharedPreferencesCredentialStore(
linkedInpref);
credentialStore.write(new String[] {
accessToken.getToken(),
accessToken.getTokenSecret() });
Log.i("LinkedinSample", "ln_access_token: "
+ accessToken.getToken());
Log.i("LinkedinSample", "ln_Token Secret_token: "
+ accessToken.getTokenSecret());
} catch (LinkedInOAuthServiceException e) {
Log.i("LinkedinSample", "error to get verifier");
e.printStackTrace();
}
}
});
// set progress dialog
progressDialog.setMessage("Loading...");
progressDialog.setCancelable(true);
progressDialog.show();
}