gpt4 book ai didi

android - Android 的 LinkedIn ID 为空

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:41:25 26 4
gpt4 key购买 nike

我正在使用以下代码 fragment 获取用户详细信息,但从 profile.getId()

获取的 Id 为空
@Override
protected void onNewIntent(Intent intent) {
String verifier = intent.getData().getQueryParameter("oauth_verifier");

LinkedInAccessToken accessToken = oAuthService.getOAuthAccessToken(
liToken, verifier);
client = factory.createLinkedInApiClient(accessToken);
client.postNetworkUpdate("LinkedIn Android app test");
Person profile = client.getProfileForCurrentUser();

System.out.println("PersonID : " + profile.getId());
System.out.println("Name : " + profile.getFirstName() + " "
+ profile.getLastName());
}

请给我任何建议。

最佳答案

我有解决办法,我已经使用以下代码 fragment 来为用户获取更多详细信息,现在它正在正确地提供所有内容,

Person profile = client.getProfileForCurrentUser(EnumSet.of(
ProfileField.ID, ProfileField.FIRST_NAME,
ProfileField.LAST_NAME, ProfileField.HEADLINE,
ProfileField.INDUSTRY, ProfileField.PICTURE_URL,
ProfileField.DATE_OF_BIRTH, ProfileField.LOCATION_NAME,
ProfileField.MAIN_ADDRESS, ProfileField.LOCATION_COUNTRY));
System.out.println("PersonID : " + profile.getId());
System.out.println("Name : " + profile.getFirstName() + " "
+ profile.getLastName());
System.out.println("Headline : " + profile.getHeadline());
System.out.println("Industry : " + profile.getIndustry());
System.out.println("Picture : " + profile.getPictureUrl());
DateOfBirth dateOfBirth = profile.getDateOfBirth();
System.out.println("DateOfBirth : " + dateOfBirth.getDay() + "/"
+ dateOfBirth.getMonth() + "/" + dateOfBirth.getYear());
System.out.println("MAin Address : " + profile.getMainAddress());
Location location = profile.getLocation();
System.out.println("Location:" + location.getName() + " - "
+ location.getCountry().getCode());

关于android - Android 的 LinkedIn ID 为空,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11051551/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com