1
기본 사용자의 프로필 데이터를 얻으려면 Google 로그인을 사용하고 있지만 Google Plus에서 사용자의 표지 사진을 얻어야합니다. Google Plus가 더 이상 사용되지 않으므로 Google People API에 대해 읽었습니다. 문제는 내가 예제 패키지가 존재하지 않기 때문에 다음 코드의 라인을 확인할 수 없습니다, here 노출Google People API를 사용하여 Google Plus 커버 사진보기
People peopleService = new People.Builder(httpTransport, jsonFactory, credential)
.build();
을 구현하려고하면 문서의 예는
import com.google.api.services.people.People;
하지만 난 경우를 사용하는 것이있다 해당 패키지를 가져 오려고하면 존재하지 않습니다. 가져올 수 있습니다.
com.google.api.services.people.v1.PeopleService.People
이 패키지에는 Builder 메소드가 없습니다. 여기
는compile 'com.google.android.gms:play-services-auth:10.2.1'
compile 'com.google.android.gms:play-services-plus:10.2.1'
compile 'com.google.apis:google-api-services-people:v1-rev91-1.21.0'
compile 'com.google.http-client:google-http-client-android:1.17.0-rc' exclude module: 'httpclient'
compile 'com.google.api-client:google-api-client-android:1.17.0-rc' exclude module: 'httpclient'
compile 'com.google.api-client:google-api-client-gson:1.17.0-rc' exclude module: 'httpclient'
compile 'com.google.api-client:google-api-client:1.21.0'
내 Gradle을 파일입니다 그리고 여기, 내가
그것은 예를 잘못처럼 보이는public static People setUp(Context context, String serverAuthCode) throws IOException {
HttpTransport httpTransport = new NetHttpTransport();
JacksonFactory jsonFactory = JacksonFactory.getDefaultInstance();
// Redirect URL for web based applications.
// Can be empty too.
String redirectUrl = "urn:ietf:wg:oauth:2.0:oob";
// STEP 1
GoogleTokenResponse tokenResponse = new GoogleAuthorizationCodeTokenRequest(
httpTransport,
jsonFactory,
context.getString(R.string.default_web_client_id),
context.getString(R.string.default_web_client_id),
serverAuthCode,
redirectUrl).execute();
// STEP 2
GoogleCredential credential = new GoogleCredential.Builder()
.setClientSecrets(context.getString(R.string.default_web_client_id), context.getString(R.string.default_web_client_id))
.setTransport(httpTransport)
.setJsonFactory(jsonFactory)
.build();
credential.setFromTokenResponse(tokenResponse);
// STEP 3
return new com.google.api.services.people.v1.PeopleService.People.Builder(httpTransport, jsonFactory, credential)
.setApplicationName("")
.build();
}
[Google+ People.get API] (https://developers.google.com/+/web/api/rest/latest/people)는 여전히 Google+ 프로필 정보를 가져 오는 방법입니다. 더 이상 사용되지 않는 Google+ People.list 메소드는 친구/팔로어 목록을 얻는 데 사용되지 않았습니다. – abraham