2017-04-19 22 views
1

基本的なユーザーのプロフィールデータを取得するにはGoogleログインを使用していますが、Google Plusからユーザーの表紙写真を取得する必要があります。私はGoogle Plusが非難されているので、Google People APIについて読んでいます。問題はGoogle People APIを使用してGoogle Plusの画像を取得する

import com.google.api.services.people.People; 

が、私の場合を使用

People peopleService = new People.Builder(httpTransport, jsonFactory, credential) 
    .build(); 

、私は hereを暴露例を実装しようとすると、パッケージが存在しないので、次のコードの行が解決できなかったことをドキュメントの例ですそのパッケージをインポートしようとすると、存在しません。インポートのみ可能

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(); 
} 
+0

[Google+ People.get API](https://developers.google.com/+/web/api/rest/latest/people)は、まだGoogle+プロフィール情報を取得する方法です。廃止予定の推奨されなくなったGoogle+ People.listメソッドは、友だちまたはフォロワーのリストを取得するためのものでした。 – abraham

答えて

0

、必要に、私はGoogleの人々APIを実装しようとどのようにお見せPeopleService.Builderを使用してください。

関連する問題