我正在我的应用程序中集成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();
}
答案 0 :(得分:0)
试试这个方法:
p.getCurrentStatus();
在这里你必须得到当前用户的个人资料:
Person p = client.getProfileForCurrentUser(EnumSet.of(ProfileField.ID));